Don't include the sync promo page in the Chome on Android build.

Chrome on Android has its own promo pages and these files are causing link errors.

BUG=113487
TEST=


Review URL: http://codereview.chromium.org/9464013

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@125767 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc
index 431a927d..d81d0a18 100644
--- a/chrome/browser/prefs/browser_prefs.cc
+++ b/chrome/browser/prefs/browser_prefs.cc
@@ -197,7 +197,6 @@
   ProfileImpl::RegisterUserPrefs(user_prefs);
   ProtocolHandlerRegistry::RegisterPrefs(user_prefs);
   SessionStartupPref::RegisterUserPrefs(user_prefs);
-  SyncPromoUI::RegisterUserPrefs(user_prefs);
   TemplateURLPrepopulateData::RegisterUserPrefs(user_prefs);
   TranslatePrefs::RegisterUserPrefs(user_prefs);
   web_intents::RegisterUserPrefs(user_prefs);
@@ -219,6 +218,7 @@
 #if !defined(OS_ANDROID)
   PluginsUI::RegisterUserPrefs(user_prefs);
   PromoResourceService::RegisterUserPrefs(user_prefs);
+  SyncPromoUI::RegisterUserPrefs(user_prefs);
 #endif
 
 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS)
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index 97dd65d..bfb1dec 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -5630,6 +5630,9 @@
 }
 
 void Browser::ShowSyncSetup() {
+  // TODO(yfriedman): remove OS_ANDROID clause when browser is excluded from
+  // Android build.
+#if !defined(OS_ANDROID)
   ProfileSyncService* service =
       ProfileSyncServiceFactory::GetInstance()->GetForProfile(
           profile()->GetOriginalProfile());
@@ -5648,6 +5651,7 @@
     LoginUIServiceFactory::GetForProfile(
         profile()->GetOriginalProfile())->ShowLoginUI();
   }
+#endif
 }
 
 void Browser::ToggleSpeechInput() {
diff --git a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
index bf34899..0e8c4bc 100644
--- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
+++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
@@ -68,7 +68,9 @@
 #include "chrome/browser/ui/webui/chromeos/sim_unlock_ui.h"
 #include "chrome/browser/ui/webui/chromeos/system_info_ui.h"
 #include "chrome/browser/ui/webui/active_downloads_ui.h"
-#else
+#endif
+
+#if !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h"
 #endif
 
@@ -294,7 +296,7 @@
     return &NewWebUI<PrintPreviewUI>;
   }
 
-#if !defined(OS_CHROMEOS)
+#if !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
   if (url.host() == chrome::kChromeUISyncPromoHost) {
     // If the sync promo page is enabled then use the sync promo WebUI otherwise
     // use the NTP WebUI. We don't want to return NULL if the sync promo page
diff --git a/chrome/browser/ui/webui/ntp/ntp_login_handler.cc b/chrome/browser/ui/webui/ntp/ntp_login_handler.cc
index 12cb8cf70..e0ff417 100644
--- a/chrome/browser/ui/webui/ntp/ntp_login_handler.cc
+++ b/chrome/browser/ui/webui/ntp/ntp_login_handler.cc
@@ -130,11 +130,13 @@
     return;
 
   if (username.empty()) {
+#if !defined(OS_ANDROID)
     // The user isn't signed in, show the sync promo.
     if (SyncPromoUI::ShouldShowSyncPromo(profile)) {
       browser->ShowSyncSetup();
       RecordInHistogram(NTP_SIGN_IN_PROMO_CLICKED);
     }
+#endif
   } else if (args->GetSize() == 4) {
     // The user is signed in, show the profiles menu.
     double x = 0;
@@ -205,17 +207,22 @@
       if (header.empty())
         header = CreateSpanWithClass(UTF8ToUTF16(username), "profile-name");
     }
-  } else if (SyncPromoUI::ShouldShowSyncPromo(profile)) {
-    string16 signed_in_link = l10n_util::GetStringUTF16(
-        IDS_SYNC_PROMO_NOT_SIGNED_IN_STATUS_LINK);
-    signed_in_link = CreateSpanWithClass(signed_in_link, "link-span");
-    header = l10n_util::GetStringFUTF16(
-        IDS_SYNC_PROMO_NOT_SIGNED_IN_STATUS_HEADER,
-        l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME));
-    sub_header = l10n_util::GetStringFUTF16(
-        IDS_SYNC_PROMO_NOT_SIGNED_IN_STATUS_SUB_HEADER, signed_in_link);
-    // Record that the user was shown the promo.
-    RecordInHistogram(NTP_SIGN_IN_PROMO_VIEWED);
+  } else {
+#if !defined(OS_ANDROID)
+    // Android uses a custom sync promo
+    if (SyncPromoUI::ShouldShowSyncPromo(profile)) {
+      string16 signed_in_link = l10n_util::GetStringUTF16(
+          IDS_SYNC_PROMO_NOT_SIGNED_IN_STATUS_LINK);
+      signed_in_link = CreateSpanWithClass(signed_in_link, "link-span");
+      header = l10n_util::GetStringFUTF16(
+          IDS_SYNC_PROMO_NOT_SIGNED_IN_STATUS_HEADER,
+          l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME));
+      sub_header = l10n_util::GetStringFUTF16(
+          IDS_SYNC_PROMO_NOT_SIGNED_IN_STATUS_SUB_HEADER, signed_in_link);
+      // Record that the user was shown the promo.
+      RecordInHistogram(NTP_SIGN_IN_PROMO_VIEWED);
+    }
+#endif
   }
 
   StringValue header_value(header);
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 3ee17d47..041f647 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -4807,6 +4807,7 @@
             ['exclude', '^browser/ui/webui/options'],
             ['exclude', '^browser/ui/webui/options2'],
             ['exclude', '^browser/ui/webui/print_preview/'],
+            ['exclude', '^browser/ui/webui/sync_promo'],
           ],
         }],
         ['OS=="mac"', {