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

Side by Side Diff: chrome/browser/ui/webui/sync_promo/sync_promo_ui.cc

Issue 12088040: Add a SigninAllowed policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to ToT, another try to upload. 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/sync_promo/sync_promo_ui.h" 5 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/string_number_conversions.h" 8 #include "base/string_number_conversions.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 #if defined(OS_CHROMEOS) 120 #if defined(OS_CHROMEOS)
121 // There's no need to show the sync promo on cros since cros users are logged 121 // There's no need to show the sync promo on cros since cros users are logged
122 // into sync already. 122 // into sync already.
123 return false; 123 return false;
124 #else 124 #else
125 125
126 // Don't bother if we don't have any kind of network connection. 126 // Don't bother if we don't have any kind of network connection.
127 if (net::NetworkChangeNotifier::IsOffline()) 127 if (net::NetworkChangeNotifier::IsOffline())
128 return false; 128 return false;
129 129
130 // Honor the signin policy.
131 if (!profile->GetOriginalProfile()->IsSigninAllowed())
132 return false;
130 // Display the signin promo if the user is not signed in. 133 // Display the signin promo if the user is not signed in.
131 SigninManager* signin = SigninManagerFactory::GetForProfile( 134 SigninManager* signin = SigninManagerFactory::GetForProfile(
132 profile->GetOriginalProfile()); 135 profile->GetOriginalProfile());
133 return signin->GetAuthenticatedUsername().empty(); 136 return signin->GetAuthenticatedUsername().empty();
134 #endif 137 #endif
135 } 138 }
136 139
137 // static 140 // static
138 void SyncPromoUI::RegisterUserPrefs(PrefServiceSyncable* prefs) { 141 void SyncPromoUI::RegisterUserPrefs(PrefServiceSyncable* prefs) {
139 prefs->RegisterIntegerPref(prefs::kSyncPromoStartupCount, 0, 142 prefs->RegisterIntegerPref(prefs::kSyncPromoStartupCount, 0,
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 g_force_web_based_signin_flow; 302 g_force_web_based_signin_flow;
300 #else 303 #else
301 return false; 304 return false;
302 #endif 305 #endif
303 } 306 }
304 307
305 // static 308 // static
306 void SyncPromoUI::ForceWebBasedSigninFlowForTesting(bool force) { 309 void SyncPromoUI::ForceWebBasedSigninFlowForTesting(bool force) {
307 g_force_web_based_signin_flow = force; 310 g_force_web_based_signin_flow = force;
308 } 311 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698