Cleanup: Remove remaining generated extensions APIs on Android. (try 2)

BUG=305852

Review URL: https://codereview.chromium.org/586623002

Cr-Commit-Position: refs/heads/master@{#296067}
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
index 9c91fad..98faecc 100644
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -150,8 +150,6 @@
       "//apps",
       "//cc",
       "//chrome/browser/devtools",
-      "//chrome/common/extensions/api",
-      "//chrome/common/extensions/api:api_registration",
       "//chrome/installer/util",
       "//components/autofill/content/browser",
       "//components/dom_distiller/content",
@@ -245,6 +243,8 @@
     deps += [
       "//chrome/browser/extensions",
       "//chrome/browser/sync_file_system/drive_backend:sync_file_system_drive_proto",
+      "//chrome/common/extensions/api",
+      "//chrome/common/extensions/api:api_registration",
     ]
     forward_dependent_configs_from += [ "//chrome/browser/extensions" ]
     sources += rebase_path(gypi_values.chrome_browser_extensions_sources,
diff --git a/chrome/browser/autocomplete/shortcuts_provider_unittest.cc b/chrome/browser/autocomplete/shortcuts_provider_unittest.cc
index 7178cff7..7c82f82 100644
--- a/chrome/browser/autocomplete/shortcuts_provider_unittest.cc
+++ b/chrome/browser/autocomplete/shortcuts_provider_unittest.cc
@@ -32,11 +32,14 @@
 #include "components/omnibox/autocomplete_result.h"
 #include "content/public/browser/notification_service.h"
 #include "content/public/test/test_browser_thread.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+#if defined(ENABLE_EXTENSIONS)
 #include "extensions/browser/notification_types.h"
 #include "extensions/common/extension.h"
 #include "extensions/common/extension_builder.h"
 #include "extensions/common/value_builder.h"
-#include "testing/gtest/include/gtest/gtest.h"
+#endif
 
 using base::ASCIIToUTF16;
 
@@ -819,6 +822,7 @@
               backend_->shortcuts_map().find(ASCIIToUTF16("delete")));
 }
 
+#if defined(ENABLE_EXTENSIONS)
 TEST_F(ShortcutsProviderTest, Extension) {
   // Try an input string that matches an extension URL.
   base::string16 text(ASCIIToUTF16("echo"));
@@ -847,3 +851,4 @@
   // Now the URL should have disappeared.
   RunTest(text, false, ExpectedURLs(), std::string(), base::string16());
 }
+#endif
diff --git a/chrome/browser/policy/managed_bookmarks_policy_handler_unittest.cc b/chrome/browser/policy/managed_bookmarks_policy_handler_unittest.cc
index a0a74bea..b8a2d69 100644
--- a/chrome/browser/policy/managed_bookmarks_policy_handler_unittest.cc
+++ b/chrome/browser/policy/managed_bookmarks_policy_handler_unittest.cc
@@ -9,9 +9,12 @@
 #include "components/policy/core/browser/configuration_policy_pref_store_test.h"
 #include "components/policy/core/common/policy_map.h"
 #include "components/policy/core/common/schema.h"
-#include "extensions/common/value_builder.h"
 #include "policy/policy_constants.h"
 
+#if defined(ENABLE_EXTENSIONS)
+#include "extensions/common/value_builder.h"
+#endif
+
 namespace policy {
 
 class ManagedBookmarksPolicyHandlerTest
@@ -23,6 +26,7 @@
   }
 };
 
+#if defined(ENABLE_EXTENSIONS)
 TEST_F(ManagedBookmarksPolicyHandlerTest, ApplyPolicySettings) {
   EXPECT_FALSE(store_->GetValue(bookmarks::prefs::kManagedBookmarks, NULL));
 
@@ -101,6 +105,7 @@
           .Build());
   EXPECT_TRUE(pref_value->Equals(expected.get()));
 }
+#endif  // defined(ENABLE_EXTENSIONS)
 
 TEST_F(ManagedBookmarksPolicyHandlerTest, WrongPolicyType) {
   PolicyMap policy;
@@ -121,6 +126,7 @@
   EXPECT_FALSE(store_->GetValue(bookmarks::prefs::kManagedBookmarks, NULL));
 }
 
+#if defined(ENABLE_EXTENSIONS)
 TEST_F(ManagedBookmarksPolicyHandlerTest, UnknownKeys) {
   PolicyMap policy;
   policy.Set(key::kManagedBookmarks,
@@ -149,7 +155,9 @@
           .Build());
   EXPECT_TRUE(pref_value->Equals(expected.get()));
 }
+#endif
 
+#if defined(ENABLE_EXTENSIONS)
 TEST_F(ManagedBookmarksPolicyHandlerTest, BadBookmark) {
   PolicyMap policy;
   policy.Set(key::kManagedBookmarks,
@@ -189,5 +197,6 @@
           .Build());
   EXPECT_TRUE(pref_value->Equals(expected.get()));
 }
+#endif
 
 }  // namespace policy
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn
index 61a22ae..1c5733f0 100644
--- a/chrome/browser/ui/BUILD.gn
+++ b/chrome/browser/ui/BUILD.gn
@@ -84,8 +84,6 @@
       "//chrome/browser/devtools",
       "//chrome/browser/ui/views",
       "//chrome/browser/ui/webui/omnibox:mojo_bindings",
-      "//chrome/common/extensions/api",
-      "//chrome/common/extensions/api:api_registration",
       "//chrome/installer/util",
       "//components/autofill/content/browser:risk_proto",
       "//components/power",
@@ -382,7 +380,11 @@
     }
   }
   if (enable_extensions) {
-    deps += [ "//chrome/browser/extensions" ]
+    deps += [
+      "//chrome/browser/extensions",
+      "//chrome/common/extensions/api",
+      "//chrome/common/extensions/api:api_registration",
+    ]
     sources += rebase_path(gypi_values.chrome_browser_ui_extensions_sources,
                            ".", "//chrome")
   }