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

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

Issue 12088040: Add a SigninAllowed policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Some bugfixes. Created 7 years, 10 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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 header_value, sub_header_value, icon_url_value, is_user_signed_in); 243 header_value, sub_header_value, icon_url_value, is_user_signed_in);
244 } 244 }
245 245
246 // static 246 // static
247 bool NTPLoginHandler::ShouldShow(Profile* profile) { 247 bool NTPLoginHandler::ShouldShow(Profile* profile) {
248 #if defined(OS_CHROMEOS) 248 #if defined(OS_CHROMEOS)
249 // For now we don't care about showing sync status on Chrome OS. The promo 249 // For now we don't care about showing sync status on Chrome OS. The promo
250 // UI and the avatar menu don't exist on that platform. 250 // UI and the avatar menu don't exist on that platform.
251 return false; 251 return false;
252 #else 252 #else
253 return !profile->IsOffTheRecord(); 253 return !profile->IsOffTheRecord() &&
254 profile->GetOriginalProfile()->IsSigninAllowed();
Andrew T Wilson (Slow) 2013/02/04 15:41:48 Probably don't need to call GetOriginalProfile() h
Adrian Kuegel 2013/02/05 10:55:15 True, this is not necessary. I removed it, now it
254 #endif 255 #endif
255 } 256 }
256 257
257 // static 258 // static
258 void NTPLoginHandler::GetLocalizedValues(Profile* profile, 259 void NTPLoginHandler::GetLocalizedValues(Profile* profile,
259 DictionaryValue* values) { 260 DictionaryValue* values) {
260 PrefService* prefs = profile->GetPrefs(); 261 PrefService* prefs = profile->GetPrefs();
261 std::string error_message = prefs->GetString(prefs::kSyncPromoErrorMessage); 262 std::string error_message = prefs->GetString(prefs::kSyncPromoErrorMessage);
262 bool hide_sync = !prefs->GetBoolean(prefs::kSyncPromoShowNTPBubble); 263 bool hide_sync = !prefs->GetBoolean(prefs::kSyncPromoShowNTPBubble);
263 264
264 string16 message = 265 string16 message =
265 hide_sync ? string16() : 266 hide_sync ? string16() :
266 !error_message.empty() ? UTF8ToUTF16(error_message) : 267 !error_message.empty() ? UTF8ToUTF16(error_message) :
267 l10n_util::GetStringFUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_MESSAGE, 268 l10n_util::GetStringFUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_MESSAGE,
268 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME)); 269 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME));
269 270
270 values->SetString("login_status_message", message); 271 values->SetString("login_status_message", message);
271 values->SetString("login_status_url", 272 values->SetString("login_status_url",
272 hide_sync ? std::string() : chrome::kSyncLearnMoreURL); 273 hide_sync ? std::string() : chrome::kSyncLearnMoreURL);
273 values->SetString("login_status_advanced", 274 values->SetString("login_status_advanced",
274 hide_sync || !error_message.empty() ? string16() : 275 hide_sync || !error_message.empty() ? string16() :
275 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_ADVANCED)); 276 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_ADVANCED));
276 values->SetString("login_status_dismiss", 277 values->SetString("login_status_dismiss",
277 hide_sync ? string16() : 278 hide_sync ? string16() :
278 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_OK)); 279 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_OK));
279 } 280 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698