Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Side by Side Diff: chrome/browser/ui/webui/ntp/ntp_login_handler.cc

Issue 259393006: Remove WebUI NTP on Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 void NTPLoginHandler::HandleShowSyncLoginUI(const base::ListValue* args) { 125 void NTPLoginHandler::HandleShowSyncLoginUI(const base::ListValue* args) {
126 Profile* profile = Profile::FromWebUI(web_ui()); 126 Profile* profile = Profile::FromWebUI(web_ui());
127 std::string username = profile->GetPrefs()->GetString( 127 std::string username = profile->GetPrefs()->GetString(
128 prefs::kGoogleServicesUsername); 128 prefs::kGoogleServicesUsername);
129 content::WebContents* web_contents = web_ui()->GetWebContents(); 129 content::WebContents* web_contents = web_ui()->GetWebContents();
130 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); 130 Browser* browser = chrome::FindBrowserWithWebContents(web_contents);
131 if (!browser) 131 if (!browser)
132 return; 132 return;
133 133
134 if (username.empty()) { 134 if (username.empty()) {
135 #if !defined(OS_ANDROID)
136 // The user isn't signed in, show the sign in promo. 135 // The user isn't signed in, show the sign in promo.
137 if (signin::ShouldShowPromo(profile)) { 136 if (signin::ShouldShowPromo(profile)) {
138 signin::Source source = 137 signin::Source source =
139 (web_contents->GetURL().spec() == chrome::kChromeUIAppsURL) ? 138 (web_contents->GetURL().spec() == chrome::kChromeUIAppsURL) ?
140 signin::SOURCE_APPS_PAGE_LINK : 139 signin::SOURCE_APPS_PAGE_LINK :
141 signin::SOURCE_NTP_LINK; 140 signin::SOURCE_NTP_LINK;
142 chrome::ShowBrowserSignin(browser, source); 141 chrome::ShowBrowserSignin(browser, source);
143 RecordInHistogram(NTP_SIGN_IN_PROMO_CLICKED); 142 RecordInHistogram(NTP_SIGN_IN_PROMO_CLICKED);
144 } 143 }
145 #endif
146 } else if (args->GetSize() == 4) { 144 } else if (args->GetSize() == 4) {
147 // The user is signed in, show the profiles menu. 145 // The user is signed in, show the profiles menu.
148 double x = 0; 146 double x = 0;
149 double y = 0; 147 double y = 0;
150 double width = 0; 148 double width = 0;
151 double height = 0; 149 double height = 0;
152 bool success = args->GetDouble(0, &x); 150 bool success = args->GetDouble(0, &x);
153 DCHECK(success); 151 DCHECK(success);
154 success = args->GetDouble(1, &y); 152 success = args->GetDouble(1, &y);
155 DCHECK(success); 153 DCHECK(success);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 cache.GetGAIAPictureOfProfileAtIndex(profile_index); 214 cache.GetGAIAPictureOfProfileAtIndex(profile_index);
217 if (image) 215 if (image)
218 icon_url = webui::GetBitmapDataUrl(GetGAIAPictureForNTP(*image)); 216 icon_url = webui::GetBitmapDataUrl(GetGAIAPictureForNTP(*image));
219 } 217 }
220 if (header.empty()) { 218 if (header.empty()) {
221 header = CreateSpanWithClass(base::UTF8ToUTF16(username), 219 header = CreateSpanWithClass(base::UTF8ToUTF16(username),
222 "profile-name"); 220 "profile-name");
223 } 221 }
224 } 222 }
225 } else { 223 } else {
226 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) 224 #if !defined(OS_CHROMEOS)
227 // Android uses a custom sign in promo. Don't call the function 225 // Chromeos does not show this status header.
228 // signin::ShouldShowPromo() since it does a bunch of checks that are not
229 // required here. We only want to suppress this login status for users that
230 // are not allowed to sign in. Chromeos does not show this status header
231 // at all.
232 SigninManager* signin = SigninManagerFactory::GetForProfile( 226 SigninManager* signin = SigninManagerFactory::GetForProfile(
233 profile->GetOriginalProfile()); 227 profile->GetOriginalProfile());
234 if (!profile->IsManaged() && signin->IsSigninAllowed()) { 228 if (!profile->IsManaged() && signin->IsSigninAllowed()) {
235 base::string16 signed_in_link = l10n_util::GetStringUTF16( 229 base::string16 signed_in_link = l10n_util::GetStringUTF16(
236 IDS_SYNC_PROMO_NOT_SIGNED_IN_STATUS_LINK); 230 IDS_SYNC_PROMO_NOT_SIGNED_IN_STATUS_LINK);
237 signed_in_link = CreateSpanWithClass(signed_in_link, "link-span"); 231 signed_in_link = CreateSpanWithClass(signed_in_link, "link-span");
238 header = l10n_util::GetStringFUTF16( 232 header = l10n_util::GetStringFUTF16(
239 IDS_SYNC_PROMO_NOT_SIGNED_IN_STATUS_HEADER, 233 IDS_SYNC_PROMO_NOT_SIGNED_IN_STATUS_HEADER,
240 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME)); 234 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME));
241 sub_header = l10n_util::GetStringFUTF16( 235 sub_header = l10n_util::GetStringFUTF16(
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 values->SetString("login_status_message", message); 273 values->SetString("login_status_message", message);
280 values->SetString("login_status_url", 274 values->SetString("login_status_url",
281 hide_sync ? std::string() : chrome::kSyncLearnMoreURL); 275 hide_sync ? std::string() : chrome::kSyncLearnMoreURL);
282 values->SetString("login_status_advanced", 276 values->SetString("login_status_advanced",
283 hide_sync ? base::string16() : 277 hide_sync ? base::string16() :
284 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_ADVANCED)); 278 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_ADVANCED));
285 values->SetString("login_status_dismiss", 279 values->SetString("login_status_dismiss",
286 hide_sync ? base::string16() : 280 hide_sync ? base::string16() :
287 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_OK)); 281 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_OK));
288 } 282 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/ntp/new_tab_ui.cc ('k') | chrome/browser/ui/webui/ntp/ntp_resource_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698