OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/webui/ntp/ntp_login_handler.h" | 5 #include "chrome/browser/ui/webui/ntp/ntp_login_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 prefs::kGoogleServicesUsername); | 135 prefs::kGoogleServicesUsername); |
136 content::WebContents* web_contents = web_ui()->GetWebContents(); | 136 content::WebContents* web_contents = web_ui()->GetWebContents(); |
137 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); | 137 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); |
138 if (!browser) | 138 if (!browser) |
139 return; | 139 return; |
140 | 140 |
141 if (username.empty()) { | 141 if (username.empty()) { |
142 #if !defined(OS_ANDROID) | 142 #if !defined(OS_ANDROID) |
143 // The user isn't signed in, show the sync promo. | 143 // The user isn't signed in, show the sync promo. |
144 if (SyncPromoUI::ShouldShowSyncPromo(profile)) { | 144 if (SyncPromoUI::ShouldShowSyncPromo(profile)) { |
145 chrome::ShowBrowserSignin(browser, SyncPromoUI::SOURCE_NTP_LINK); | 145 SyncPromoUI::Source source = |
| 146 (web_contents->GetURL().spec() == chrome::kChromeUIAppsURL) ? |
| 147 SyncPromoUI::SOURCE_APPS_PAGE_LINK : SyncPromoUI::SOURCE_NTP_LINK; |
| 148 chrome::ShowBrowserSignin(browser, source); |
146 RecordInHistogram(NTP_SIGN_IN_PROMO_CLICKED); | 149 RecordInHistogram(NTP_SIGN_IN_PROMO_CLICKED); |
147 } | 150 } |
148 #endif | 151 #endif |
149 } else if (args->GetSize() == 4 && | 152 } else if (args->GetSize() == 4 && |
150 chrome::IsCommandEnabled(browser, IDC_SHOW_AVATAR_MENU)) { | 153 chrome::IsCommandEnabled(browser, IDC_SHOW_AVATAR_MENU)) { |
151 // The user is signed in, show the profiles menu. | 154 // The user is signed in, show the profiles menu. |
152 double x = 0; | 155 double x = 0; |
153 double y = 0; | 156 double y = 0; |
154 double width = 0; | 157 double width = 0; |
155 double height = 0; | 158 double height = 0; |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 values->SetString("login_status_message", message); | 282 values->SetString("login_status_message", message); |
280 values->SetString("login_status_url", | 283 values->SetString("login_status_url", |
281 hide_sync ? std::string() : chrome::kSyncLearnMoreURL); | 284 hide_sync ? std::string() : chrome::kSyncLearnMoreURL); |
282 values->SetString("login_status_advanced", | 285 values->SetString("login_status_advanced", |
283 hide_sync || !error_message.empty() ? string16() : | 286 hide_sync || !error_message.empty() ? string16() : |
284 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_ADVANCED)); | 287 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_ADVANCED)); |
285 values->SetString("login_status_dismiss", | 288 values->SetString("login_status_dismiss", |
286 hide_sync ? string16() : | 289 hide_sync ? string16() : |
287 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_OK)); | 290 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_OK)); |
288 } | 291 } |
OLD | NEW |