Remove the enable_themes build flag and define.

This is always defined on non-mobile platforms and it is not possible to
override in the build. Since //chrome is no longer build on iOS, most uses
can be easily keyed off of the Android defines. For files not compiled on
Android, the conditionals were removed altogether.

This change additionally coalesces some Android blocks in
chrome/browser/BUILD.gn and chrome/browser/ui/BUILD.gn

BUG=671706

Review-Url: https://codereview.chromium.org/2561013002
Cr-Commit-Position: refs/heads/master@{#437784}
diff --git a/build/config/BUILD.gn b/build/config/BUILD.gn
index f77a46e..6cb4134 100644
--- a/build/config/BUILD.gn
+++ b/build/config/BUILD.gn
@@ -136,9 +136,6 @@
   if (!enable_nacl) {
     defines += [ "DISABLE_NACL" ]
   }
-  if (enable_themes) {
-    defines += [ "ENABLE_THEMES=1" ]
-  }
   if (enable_rlz) {
     defines += [ "ENABLE_RLZ" ]
   }
diff --git a/build/config/features.gni b/build/config/features.gni
index 49386f3..9128af4 100644
--- a/build/config/features.gni
+++ b/build/config/features.gni
@@ -79,8 +79,6 @@
 
 # Additional dependent variables -----------------------------------------------
 
-enable_themes = !is_android && !is_ios
-
 # Whether we are using the rlz library or not.  Platforms like Android send
 # rlz codes for searches but do not use the library.
 enable_rlz_support = is_win || is_mac || is_ios || is_chromeos
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
index 4bad36d..a166fed8 100644
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -2283,25 +2283,6 @@
       sources -= [ "net/nss_context_linux.cc" ]
     }
   }
-  if (enable_themes) {
-    sources += [
-      "sync/glue/theme_data_type_controller.cc",
-      "sync/glue/theme_data_type_controller.h",
-      "themes/browser_theme_pack.cc",
-      "themes/browser_theme_pack.h",
-      "themes/custom_theme_supplier.cc",
-      "themes/custom_theme_supplier.h",
-      "themes/theme_properties.cc",
-      "themes/theme_service.cc",
-      "themes/theme_service.h",
-      "themes/theme_service_factory.cc",
-      "themes/theme_service_factory.h",
-      "themes/theme_service_mac.mm",
-      "themes/theme_syncable_service.cc",
-      "themes/theme_syncable_service.h",
-    ]
-    deps += [ ":theme_properties" ]
-  }
 
   if (enable_basic_printing || enable_print_preview) {
     # Some form of printing support.
@@ -2765,6 +2746,8 @@
       "sync/glue/extension_data_type_controller.h",
       "sync/glue/extension_setting_data_type_controller.cc",
       "sync/glue/extension_setting_data_type_controller.h",
+      "sync/glue/theme_data_type_controller.cc",
+      "sync/glue/theme_data_type_controller.h",
       "sync/sync_ui_util.cc",
       "sync/sync_ui_util.h",
       "task_manager/providers/browser_process_task.cc",
@@ -2833,6 +2816,18 @@
       "task_manager/task_manager_interface.h",
       "task_manager/task_manager_observer.cc",
       "task_manager/task_manager_observer.h",
+      "themes/browser_theme_pack.cc",
+      "themes/browser_theme_pack.h",
+      "themes/custom_theme_supplier.cc",
+      "themes/custom_theme_supplier.h",
+      "themes/theme_properties.cc",
+      "themes/theme_service.cc",
+      "themes/theme_service.h",
+      "themes/theme_service_factory.cc",
+      "themes/theme_service_factory.h",
+      "themes/theme_service_mac.mm",
+      "themes/theme_syncable_service.cc",
+      "themes/theme_syncable_service.h",
       "upgrade_detector.cc",
       "upgrade_detector.h",
       "usb/usb_chooser_controller.cc",
@@ -2843,6 +2838,7 @@
       "usb/web_usb_detector.h",
     ]
     deps += [
+      ":theme_properties",
       "//apps",
       "//chrome/browser/policy:path_parser",
       "//chrome/browser/profile_resetter:profile_reset_report_proto",
@@ -3675,9 +3671,9 @@
     ]
   }
   if (enable_supervised_users && !is_android) {
-    # TODO(bauerb): This code should be removed (on desktop) once child account
-    # support has launched (https://crbug.com/505443).
     sources += [
+      # TODO(bauerb): The legacy code should be removed (on desktop) once child
+      # account support has launched (https://crbug.com/505443).
       "supervised_user/legacy/custodian_profile_downloader_service.cc",
       "supervised_user/legacy/custodian_profile_downloader_service.h",
       "supervised_user/legacy/custodian_profile_downloader_service_factory.cc",
@@ -3705,10 +3701,6 @@
       "supervised_user/legacy/supervised_user_sync_service_factory.cc",
       "supervised_user/legacy/supervised_user_sync_service_factory.h",
       "supervised_user/legacy/supervised_user_sync_service_observer.h",
-    ]
-  }
-  if (enable_supervised_users && enable_themes) {
-    sources += [
       "supervised_user/supervised_user_theme.cc",
       "supervised_user/supervised_user_theme.h",
     ]
diff --git a/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc b/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc
index 9e971b2..1b72b9f 100644
--- a/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc
+++ b/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc
@@ -289,6 +289,7 @@
   PasswordManagerSettingMigratorServiceFactory::GetInstance();
 #if !defined(OS_ANDROID)
   PinnedTabServiceFactory::GetInstance();
+  ThemeServiceFactory::GetInstance();
 #endif
 #if BUILDFLAG(ENABLE_PLUGINS)
   PluginPrefsFactory::GetInstance();
@@ -334,9 +335,6 @@
   TabRestoreServiceFactory::GetInstance();
   TemplateURLFetcherFactory::GetInstance();
   TemplateURLServiceFactory::GetInstance();
-#if defined(ENABLE_THEMES)
-  ThemeServiceFactory::GetInstance();
-#endif
 #if defined(OS_WIN)
   TriggeredProfileResetterFactory::GetInstance();
 #endif
diff --git a/chrome/browser/search/instant_service.cc b/chrome/browser/search/instant_service.cc
index 5e399588..c897a96 100644
--- a/chrome/browser/search/instant_service.cc
+++ b/chrome/browser/search/instant_service.cc
@@ -51,13 +51,10 @@
 
 #if !defined(OS_ANDROID)
 #include "chrome/browser/search/local_ntp_source.h"
-#endif
-
-#if defined(ENABLE_THEMES)
 #include "chrome/browser/themes/theme_properties.h"
 #include "chrome/browser/themes/theme_service.h"
 #include "chrome/browser/themes/theme_service_factory.h"
-#endif  // defined(ENABLE_THEMES)
+#endif
 
 namespace {
 
@@ -136,18 +133,15 @@
   }
 
   // Set up the data sources that Instant uses on the NTP.
-#if defined(ENABLE_THEMES)
+  // TODO(aurimas) remove this #if once instant_service.cc is no longer compiled
+  // on Android.
+#if !defined(OS_ANDROID)
   // Listen for theme installation.
   registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
                  content::Source<ThemeService>(
                      ThemeServiceFactory::GetForProfile(profile_)));
 
   content::URLDataSource::Add(profile_, new ThemeSource(profile_));
-#endif  // defined(ENABLE_THEMES)
-
-  // TODO(aurimas) remove this #if once instant_service.cc is no longer compiled
-  // on Android.
-#if !defined(OS_ANDROID)
   content::URLDataSource::Add(profile_, new LocalNtpSource(profile_));
   content::URLDataSource::Add(profile_, new ThumbnailSource(profile_, false));
   content::URLDataSource::Add(profile_, new ThumbnailSource(profile_, true));
@@ -228,7 +222,7 @@
 }
 
 void InstantService::UpdateThemeInfo() {
-#if defined(ENABLE_THEMES)
+#if !defined(OS_ANDROID)
   // Update theme background info.
   // Initialize |theme_info| if necessary.
   if (!theme_info_) {
@@ -237,7 +231,7 @@
     for (InstantServiceObserver& observer : observers_)
       observer.ThemeInfoChanged(*theme_info_);
   }
-#endif  // defined(ENABLE_THEMES)
+#endif  // !defined(OS_ANDROID)
 }
 
 void InstantService::UpdateMostVisitedItemsInfo() {
@@ -288,11 +282,11 @@
       OnRendererProcessTerminated(
           content::Source<content::RenderProcessHost>(source)->GetID());
       break;
-#if defined(ENABLE_THEMES)
+#if !defined(OS_ANDROID)
     case chrome::NOTIFICATION_BROWSER_THEME_CHANGED:
       OnThemeChanged();
       break;
-#endif  // defined(ENABLE_THEMES)
+#endif  // !defined(OS_ANDROID)
     default:
       NOTREACHED() << "Unexpected notification type in InstantService.";
   }
@@ -347,7 +341,7 @@
     observer.MostVisitedItemsChanged(most_visited_items_);
 }
 
-#if defined(ENABLE_THEMES)
+#if !defined(OS_ANDROID)
 
 namespace {
 
@@ -466,7 +460,7 @@
   for (InstantServiceObserver& observer : observers_)
     observer.ThemeInfoChanged(*theme_info_);
 }
-#endif  // defined(ENABLE_THEMES)
+#endif  // !defined(OS_ANDROID)
 
 void InstantService::OnTemplateURLServiceChanged() {
   // Check whether the default search provider was changed.
diff --git a/chrome/browser/search/instant_service.h b/chrome/browser/search/instant_service.h
index 47d4f34d..064ca1db 100644
--- a/chrome/browser/search/instant_service.h
+++ b/chrome/browser/search/instant_service.h
@@ -14,6 +14,7 @@
 #include "base/memory/ref_counted.h"
 #include "base/memory/weak_ptr.h"
 #include "base/observer_list.h"
+#include "build/build_config.h"
 #include "components/history/core/browser/history_types.h"
 #include "components/history/core/browser/top_sites_observer.h"
 #include "components/keyed_service/core/keyed_service.h"
@@ -145,7 +146,7 @@
   // Notifies the observer about the last known most visited items.
   void NotifyAboutMostVisitedItems();
 
-#if defined(ENABLE_THEMES)
+#if !defined(OS_ANDROID)
   // Theme changed notification handler.
   void OnThemeChanged();
 #endif
diff --git a/chrome/browser/search/instant_service_factory.cc b/chrome/browser/search/instant_service_factory.cc
index 6cc76f3..c2d9e92 100644
--- a/chrome/browser/search/instant_service_factory.cc
+++ b/chrome/browser/search/instant_service_factory.cc
@@ -4,6 +4,7 @@
 
 #include "chrome/browser/search/instant_service_factory.h"
 
+#include "build/build_config.h"
 #include "chrome/browser/history/top_sites_factory.h"
 #include "chrome/browser/profiles/incognito_helpers.h"
 #include "chrome/browser/profiles/profile.h"
@@ -34,7 +35,7 @@
         BrowserContextDependencyManager::GetInstance()) {
   DependsOn(suggestions::SuggestionsServiceFactory::GetInstance());
   DependsOn(TemplateURLServiceFactory::GetInstance());
-#if defined(ENABLE_THEMES)
+#if !defined(OS_ANDROID)
   DependsOn(ThemeServiceFactory::GetInstance());
 #endif
   DependsOn(TopSitesFactory::GetInstance());
diff --git a/chrome/browser/supervised_user/supervised_user_service.cc b/chrome/browser/supervised_user/supervised_user_service.cc
index aed7f3d..324f525d6 100644
--- a/chrome/browser/supervised_user/supervised_user_service.cc
+++ b/chrome/browser/supervised_user/supervised_user_service.cc
@@ -62,6 +62,8 @@
 #include "chrome/browser/supervised_user/legacy/supervised_user_pref_mapping_service_factory.h"
 #include "chrome/browser/supervised_user/legacy/supervised_user_registration_utility.h"
 #include "chrome/browser/supervised_user/legacy/supervised_user_shared_settings_service_factory.h"
+#include "chrome/browser/themes/theme_service.h"
+#include "chrome/browser/themes/theme_service_factory.h"
 #endif
 
 #if defined(OS_CHROMEOS)
@@ -78,11 +80,6 @@
 #include "extensions/browser/extension_system.h"
 #endif
 
-#if defined(ENABLE_THEMES)
-#include "chrome/browser/themes/theme_service.h"
-#include "chrome/browser/themes/theme_service_factory.h"
-#endif
-
 using base::DictionaryValue;
 using base::UserMetricsAction;
 using content::BrowserThread;
@@ -588,7 +585,7 @@
 
   // Now activate/deactivate anything not handled by the delegate yet.
 
-#if defined(ENABLE_THEMES)
+#if !defined(OS_ANDROID)
   // Re-set the default theme to turn the SU theme on/off.
   ThemeService* theme_service = ThemeServiceFactory::GetForProfile(profile_);
   if (theme_service->UsingDefaultTheme() || theme_service->UsingSystemTheme())
diff --git a/chrome/browser/sync/chrome_sync_client.cc b/chrome/browser/sync/chrome_sync_client.cc
index d0d6de1..bad033e 100644
--- a/chrome/browser/sync/chrome_sync_client.cc
+++ b/chrome/browser/sync/chrome_sync_client.cc
@@ -346,7 +346,7 @@
       return app_list::AppListSyncableServiceFactory::GetForProfile(profile_)->
           AsWeakPtr();
 #endif
-#if defined(ENABLE_THEMES)
+#if !defined(OS_ANDROID)
     case syncer::THEMES:
       return ThemeServiceFactory::GetForProfile(profile_)->
           GetThemeSyncableService()->AsWeakPtr();
@@ -543,7 +543,7 @@
   }
 #endif
 
-#if defined(ENABLE_THEMES)
+#if !defined(OS_ANDROID)
   // Theme sync is enabled by default.  Register unless explicitly disabled.
   if (!disabled_types.Has(syncer::THEMES)) {
     sync_service->RegisterDataTypeController(
diff --git a/chrome/browser/sync/profile_sync_service_factory.cc b/chrome/browser/sync/profile_sync_service_factory.cc
index e36d7d8..ce61b07 100644
--- a/chrome/browser/sync/profile_sync_service_factory.cc
+++ b/chrome/browser/sync/profile_sync_service_factory.cc
@@ -111,6 +111,7 @@
   DependsOn(GaiaCookieManagerServiceFactory::GetInstance());
 #if !defined(OS_ANDROID)
   DependsOn(GlobalErrorServiceFactory::GetInstance());
+  DependsOn(ThemeServiceFactory::GetInstance());
 #endif
   DependsOn(HistoryServiceFactory::GetInstance());
   DependsOn(invalidation::ProfileInvalidationProviderFactory::GetInstance());
@@ -118,9 +119,6 @@
   DependsOn(ProfileOAuth2TokenServiceFactory::GetInstance());
   DependsOn(SigninManagerFactory::GetInstance());
   DependsOn(TemplateURLServiceFactory::GetInstance());
-#if defined(ENABLE_THEMES)
-  DependsOn(ThemeServiceFactory::GetInstance());
-#endif
   DependsOn(WebDataServiceFactory::GetInstance());
 #if BUILDFLAG(ENABLE_EXTENSIONS)
   DependsOn(
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn
index c29cffcd..559b0fa 100644
--- a/chrome/browser/ui/BUILD.gn
+++ b/chrome/browser/ui/BUILD.gn
@@ -2101,13 +2101,6 @@
       "webui/settings/native_certificates_handler.h",
     ]
   }
-  if (enable_themes) {
-    sources += [
-      "webui/theme_source.cc",
-      "webui/theme_source.h",
-    ]
-    deps += [ "//chrome/browser:theme_properties" ]
-  }
   if (enable_print_preview) {
     sources += [
       "webui/print_preview/extension_printer_handler.cc",
@@ -2274,7 +2267,13 @@
       deps -= [ "//ui/events" ]
     }
   } else {
-    sources += [ "browser_window.h" ]
+    # !is_android
+    sources += [
+      "browser_window.h",
+      "webui/theme_source.cc",
+      "webui/theme_source.h",
+    ]
+    deps += [ "//chrome/browser:theme_properties" ]
   }
 
   if (is_mac) {
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index 4346367..09923f0 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -395,7 +395,7 @@
   registrar_.Add(this,
                  extensions::NOTIFICATION_EXTENSION_PROCESS_TERMINATED,
                  content::NotificationService::AllSources());
-#if defined(ENABLE_THEMES)
+#if !defined(OS_ANDROID)
   registrar_.Add(
       this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
       content::Source<ThemeService>(
@@ -1994,7 +1994,7 @@
       break;
     }
 
-#if defined(ENABLE_THEMES)
+#if !defined(OS_ANDROID)
     case chrome::NOTIFICATION_BROWSER_THEME_CHANGED:
       window()->UserChangedTheme();
       break;
diff --git a/chrome/browser/ui/prefs/prefs_tab_helper.cc b/chrome/browser/ui/prefs/prefs_tab_helper.cc
index 1ca4331..eb7a87d 100644
--- a/chrome/browser/ui/prefs/prefs_tab_helper.cc
+++ b/chrome/browser/ui/prefs/prefs_tab_helper.cc
@@ -50,7 +50,7 @@
 #include "third_party/icu/source/common/unicode/uscript.h"
 #include "ui/base/l10n/l10n_util.h"
 
-#if defined(OS_POSIX) && !defined(OS_MACOSX) && defined(ENABLE_THEMES)
+#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)
 #include "chrome/browser/themes/theme_service.h"
 #include "chrome/browser/themes/theme_service_factory.h"
 #endif
@@ -490,7 +490,7 @@
                                                       profile_,
                                                       web_contents_);
 
-#if defined(OS_POSIX) && !defined(OS_MACOSX) && defined(ENABLE_THEMES)
+#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)
   registrar_.Add(this,
                  chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
                  content::Source<ThemeService>(
@@ -604,7 +604,7 @@
 void PrefsTabHelper::Observe(int type,
                              const content::NotificationSource& source,
                              const content::NotificationDetails& details) {
-#if defined(OS_POSIX) && !defined(OS_MACOSX) && defined(ENABLE_THEMES)
+#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)
   if (type == chrome::NOTIFICATION_BROWSER_THEME_CHANGED) {
     UpdateRendererPreferences();
     return;
diff --git a/chrome/browser/ui/webui/about_ui.cc b/chrome/browser/ui/webui/about_ui.cc
index 1e8943c3..ba30139d 100644
--- a/chrome/browser/ui/webui/about_ui.cc
+++ b/chrome/browser/ui/webui/about_ui.cc
@@ -71,7 +71,7 @@
 #include "ui/base/webui/web_ui_util.h"
 #include "url/gurl.h"
 
-#if defined(ENABLE_THEMES)
+#if !defined(OS_ANDROID)
 #include "chrome/browser/ui/webui/theme_source.h"
 #endif
 
@@ -855,7 +855,7 @@
     : WebUIController(web_ui) {
   Profile* profile = Profile::FromWebUI(web_ui);
 
-#if defined(ENABLE_THEMES)
+#if !defined(OS_ANDROID)
   // Set up the chrome://theme/ source.
   ThemeSource* theme = new ThemeSource(profile);
   content::URLDataSource::Add(profile, theme);
diff --git a/chrome/browser/ui/webui/app_launcher_page_ui.cc b/chrome/browser/ui/webui/app_launcher_page_ui.cc
index 252ec9a..bde7507 100644
--- a/chrome/browser/ui/webui/app_launcher_page_ui.cc
+++ b/chrome/browser/ui/webui/app_launcher_page_ui.cc
@@ -16,6 +16,7 @@
 #include "chrome/browser/ui/webui/ntp/core_app_launcher_handler.h"
 #include "chrome/browser/ui/webui/ntp/favicon_webui_handler.h"
 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache.h"
+#include "chrome/browser/ui/webui/theme_handler.h"
 #include "chrome/common/url_constants.h"
 #include "chrome/grit/generated_resources.h"
 #include "chrome/grit/theme_resources.h"
@@ -27,10 +28,6 @@
 #include "ui/base/l10n/l10n_util.h"
 #include "ui/base/resource/resource_bundle.h"
 
-#if defined(ENABLE_THEMES)
-#include "chrome/browser/ui/webui/theme_handler.h"
-#endif
-
 class ExtensionService;
 
 using content::BrowserThread;
@@ -53,12 +50,10 @@
     web_ui->AddMessageHandler(new MetricsHandler());
   }
 
-#if defined(ENABLE_THEMES)
   // The theme handler can require some CPU, so do it after hooking up the most
   // visited handler. This allows the DB query for the new tab thumbs to happen
   // earlier.
   web_ui->AddMessageHandler(new ThemeHandler());
-#endif
 
   std::unique_ptr<HTMLSource> html_source(
       new HTMLSource(GetProfile()->GetOriginalProfile()));
diff --git a/chrome/browser/ui/webui/md_downloads/md_downloads_ui.cc b/chrome/browser/ui/webui/md_downloads/md_downloads_ui.cc
index 25faf41..594e63d 100644
--- a/chrome/browser/ui/webui/md_downloads/md_downloads_ui.cc
+++ b/chrome/browser/ui/webui/md_downloads/md_downloads_ui.cc
@@ -148,10 +148,8 @@
   // Set up the chrome://downloads/ source.
   content::WebUIDataSource* source = CreateDownloadsUIHTMLSource(profile);
   content::WebUIDataSource::Add(profile, source);
-#if defined(ENABLE_THEMES)
   ThemeSource* theme = new ThemeSource(profile);
   content::URLDataSource::Add(profile, theme);
-#endif
 }
 
 // static
diff --git a/chrome/browser/ui/webui/ntp/app_resource_cache_factory.cc b/chrome/browser/ui/webui/ntp/app_resource_cache_factory.cc
index d9baa7c..7049709 100644
--- a/chrome/browser/ui/webui/ntp/app_resource_cache_factory.cc
+++ b/chrome/browser/ui/webui/ntp/app_resource_cache_factory.cc
@@ -25,9 +25,7 @@
     : BrowserContextKeyedServiceFactory(
         "AppResourceCache",
         BrowserContextDependencyManager::GetInstance()) {
-#if defined(ENABLE_THEMES)
   DependsOn(ThemeServiceFactory::GetInstance());
-#endif
 }
 
 AppResourceCacheFactory::~AppResourceCacheFactory() {}
diff --git a/chrome/browser/ui/webui/ntp/new_tab_ui.cc b/chrome/browser/ui/webui/ntp/new_tab_ui.cc
index 8a9faccb..ddc42c4 100644
--- a/chrome/browser/ui/webui/ntp/new_tab_ui.cc
+++ b/chrome/browser/ui/webui/ntp/new_tab_ui.cc
@@ -17,6 +17,7 @@
 #include "chrome/browser/ui/webui/ntp/favicon_webui_handler.h"
 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache.h"
 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache_factory.h"
+#include "chrome/browser/ui/webui/theme_handler.h"
 #include "chrome/common/url_constants.h"
 #include "components/bookmarks/common/bookmark_pref_names.h"
 #include "components/prefs/pref_service.h"
@@ -30,10 +31,6 @@
 #include "ui/base/resource/resource_bundle.h"
 #include "url/gurl.h"
 
-#if defined(ENABLE_THEMES)
-#include "chrome/browser/ui/webui/theme_handler.h"
-#endif
-
 using content::BrowserThread;
 using content::WebUIController;
 
@@ -74,10 +71,8 @@
       web_ui->AddMessageHandler(new AppLauncherHandler(service));
   }
 
-#if defined(ENABLE_THEMES)
   if (!profile->IsGuestSession())
     web_ui->AddMessageHandler(new ThemeHandler());
-#endif
 
   std::unique_ptr<NewTabHTMLSource> html_source(
       new NewTabHTMLSource(profile->GetOriginalProfile()));
diff --git a/chrome/browser/ui/webui/ntp/ntp_resource_cache_factory.cc b/chrome/browser/ui/webui/ntp/ntp_resource_cache_factory.cc
index 50f602b..1f9b0d10 100644
--- a/chrome/browser/ui/webui/ntp/ntp_resource_cache_factory.cc
+++ b/chrome/browser/ui/webui/ntp/ntp_resource_cache_factory.cc
@@ -27,9 +27,7 @@
         "NTPResourceCache",
         BrowserContextDependencyManager::GetInstance()) {
   DependsOn(SigninManagerFactory::GetInstance());
-#if defined(ENABLE_THEMES)
   DependsOn(ThemeServiceFactory::GetInstance());
-#endif
 }
 
 NTPResourceCacheFactory::~NTPResourceCacheFactory() {}
diff --git a/chrome/browser/ui/webui/signin/md_user_manager_ui.cc b/chrome/browser/ui/webui/signin/md_user_manager_ui.cc
index db5c76e..51bb97e 100644
--- a/chrome/browser/ui/webui/signin/md_user_manager_ui.cc
+++ b/chrome/browser/ui/webui/signin/md_user_manager_ui.cc
@@ -48,11 +48,9 @@
   // Set up the chrome://md-user-manager/ source.
   content::WebUIDataSource::Add(profile, CreateUIDataSource(localized_strings));
 
-#if defined(ENABLE_THEMES)
   // Set up the chrome://theme/ source
   ThemeSource* theme = new ThemeSource(profile);
   content::URLDataSource::Add(profile, theme);
-#endif
 }
 
 MDUserManagerUI::~MDUserManagerUI() {}
diff --git a/chrome/browser/ui/webui/version_ui.cc b/chrome/browser/ui/webui/version_ui.cc
index 2d5f5b54..99a800b 100644
--- a/chrome/browser/ui/webui/version_ui.cc
+++ b/chrome/browser/ui/webui/version_ui.cc
@@ -28,13 +28,11 @@
 #include "ui/base/l10n/l10n_util.h"
 #include "v8/include/v8.h"
 
-#if defined(ENABLE_THEMES)
-#include "chrome/browser/ui/webui/theme_source.h"
-#endif
-
 #if defined(OS_ANDROID)
 #include "base/android/build_info.h"
 #include "chrome/browser/ui/android/android_about_app_info.h"
+#else  // !defined(OS_ANDROID)
+#include "chrome/browser/ui/webui/theme_source.h"
 #endif
 
 #if defined(OS_CHROMEOS)
@@ -167,7 +165,7 @@
   web_ui->AddMessageHandler(new VersionHandler());
 #endif
 
-#if defined(ENABLE_THEMES)
+#if !defined(OS_ANDROID)
   // Set up the chrome://theme/ source.
   ThemeSource* theme = new ThemeSource(profile);
   content::URLDataSource::Add(profile, theme);
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn
index d7f635d..3b2b53a 100644
--- a/chrome/test/BUILD.gn
+++ b/chrome/test/BUILD.gn
@@ -3249,7 +3249,6 @@
     "../browser/policy/file_selection_dialogs_policy_handler_unittest.cc",
     "../browser/policy/javascript_policy_handler_unittest.cc",
     "../browser/policy/managed_bookmarks_policy_handler_unittest.cc",
-    "../browser/policy/policy_path_parser_unittest.cc",
     "../browser/policy/profile_policy_connector_unittest.cc",
     "../browser/predictors/autocomplete_action_predictor_table_unittest.cc",
     "../browser/predictors/autocomplete_action_predictor_unittest.cc",
@@ -3527,8 +3526,8 @@
   }
 
   if (is_android) {
-    # Offline pages are currently only on Android.
     sources += [
+      # Offline pages are currently only on Android.
       "../browser/android/offline_pages/offline_page_mhtml_archiver_unittest.cc",
       "../browser/android/offline_pages/offline_page_request_job_unittest.cc",
       "../browser/android/offline_pages/offline_page_utils_unittest.cc",
@@ -3541,8 +3540,13 @@
       "../browser/android/offline_pages/test_offline_page_model_builder.h",
       "../browser/android/offline_pages/test_request_coordinator_builder.cc",
       "../browser/android/offline_pages/test_request_coordinator_builder.h",
+      "../browser/autofill/autofill_credit_card_filling_infobar_delegate_mobile_unittest.cc",
+      "../browser/autofill/autofill_save_card_infobar_delegate_mobile_unittest.cc",
+      "../browser/password_manager/account_chooser_dialog_android_unittest.cc",
+      "../browser/password_manager/auto_signin_first_run_dialog_android_unittest.cc",
+      "../browser/password_manager/save_password_infobar_delegate_android_unittest.cc",
+      "../browser/permissions/permission_queue_controller_unittest.cc",
     ]
-    sources -= [ "../browser/policy/policy_path_parser_unittest.cc" ]
     deps += [
       ":unit_tests_java",
       "//components/gcm_driver/instance_id/android:instance_id_driver_java",
@@ -3551,12 +3555,12 @@
       "//components/offline_pages/core/background:test_support",
       "//v8:v8_external_startup_data_assets",
     ]
-    deps -= [ "//third_party/libaddressinput" ]
 
     android_manifest =
         "//chrome/test/android/unit_tests_apk/AndroidManifest.xml"
     enable_multidex = true
   } else {
+    # !is_android
     sources += [
       # Bookmark export/import are handled via the BookmarkColumns
       # ContentProvider.
@@ -3595,6 +3599,7 @@
       "../browser/notifications/message_center_settings_controller_unittest.cc",
       "../browser/permissions/permission_request_manager_unittest.cc",
       "../browser/platform_util_unittest.cc",
+      "../browser/policy/policy_path_parser_unittest.cc",
       "../browser/power_usage_monitor/power_usage_monitor_unittest.cc",
       "../browser/process_singleton_posix_unittest.cc",
       "../browser/profile_resetter/profile_resetter_unittest.cc",
@@ -3619,7 +3624,12 @@
       "../browser/task_manager/task_manager_observer_unittest.cc",
       "../browser/task_manager/test_task_manager.cc",
       "../browser/task_manager/test_task_manager.h",
+      "../browser/themes/browser_theme_pack_unittest.cc",
+      "../browser/themes/theme_properties_unittest.cc",
+      "../browser/themes/theme_service_unittest.cc",
+      "../browser/themes/theme_syncable_service_unittest.cc",
       "../browser/translate/translate_manager_render_view_host_unittest.cc",
+      "../browser/ui/webui/theme_source_unittest.cc",
 
       # The autofill popup is implemented in mostly native code on Android.
       "../browser/ui/autofill/autofill_popup_controller_unittest.cc",
@@ -3721,7 +3731,10 @@
     ]
     sources -=
         [ "../browser/download/download_request_infobar_delegate_unittest.cc" ]
-    deps += [ "//device/battery:mojo_bindings" ]
+    deps += [
+      "//device/battery:mojo_bindings",
+      "//third_party/libaddressinput",
+    ]
   }
 
   if (!is_ios && !is_android) {
@@ -4647,16 +4660,6 @@
     # other things like the ui and startup tests. *shrug*
     ldflags = [ "-Wl,-ObjC" ]
   }
-  if (is_android) {
-    sources += [
-      "../browser/autofill/autofill_credit_card_filling_infobar_delegate_mobile_unittest.cc",
-      "../browser/autofill/autofill_save_card_infobar_delegate_mobile_unittest.cc",
-      "../browser/password_manager/account_chooser_dialog_android_unittest.cc",
-      "../browser/password_manager/auto_signin_first_run_dialog_android_unittest.cc",
-      "../browser/password_manager/save_password_infobar_delegate_android_unittest.cc",
-      "../browser/permissions/permission_queue_controller_unittest.cc",
-    ]
-  }
   if (!is_mac && !is_ios) {
     deps += [
       "//chrome:packed_resources",
@@ -4743,15 +4746,6 @@
       "../browser/upgrade_detector_impl_unittest.cc",
     ]
   }
-  if (enable_themes) {
-    sources += [
-      "../browser/themes/browser_theme_pack_unittest.cc",
-      "../browser/themes/theme_properties_unittest.cc",
-      "../browser/themes/theme_service_unittest.cc",
-      "../browser/themes/theme_syncable_service_unittest.cc",
-      "../browser/ui/webui/theme_source_unittest.cc",
-    ]
-  }
   if (toolkit_views) {
     deps += [
       "//components/web_modal:test_support",
diff --git a/components/version_ui/resources/about_version.html b/components/version_ui/resources/about_version.html
index 9900014c..3727044 100644
--- a/components/version_ui/resources/about_version.html
+++ b/components/version_ui/resources/about_version.html
@@ -33,10 +33,11 @@
   <body>
     <div id="outer">
       <div id="logo">
-<if expr="enable_themes">
+<if expr="not is_android and not is_ios">
+        <!-- Version for themes. -->
         <img src="chrome://theme/IDR_PRODUCT_LOGO">
 </if>
-<if expr="not enable_themes">
+<if expr="is_ios or is_android">
         <img src="../../../components/resources/default_100_percent/%DISTRIBUTION%/product_logo.png">
 </if>
         <div id="company" i18n-content="company"></div>
diff --git a/tools/grit/grit_rule.gni b/tools/grit/grit_rule.gni
index edd3880a..00dd9258 100644
--- a/tools/grit/grit_rule.gni
+++ b/tools/grit/grit_rule.gni
@@ -240,12 +240,6 @@
     "enable_media_router",
   ]
 }
-if (enable_themes) {
-  grit_defines += [
-    "-D",
-    "enable_themes",
-  ]
-}
 
 # TODO(aberent): Enable for other platforms once the build machines have
 #                Java on them (and hence can run the closure compiler).