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

Side by Side Diff: chrome/browser/ui/chrome_pages.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/chrome_pages.h" 5 #include "chrome/browser/ui/chrome_pages.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/string_number_conversions.h" 8 #include "base/string_number_conversions.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "chrome/browser/download/download_shelf.h" 10 #include "chrome/browser/download/download_shelf.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/signin/signin_manager.h" 12 #include "chrome/browser/signin/signin_manager.h"
13 #include "chrome/browser/signin/signin_manager_factory.h"
13 #include "chrome/browser/sync/profile_sync_service.h" 14 #include "chrome/browser/sync/profile_sync_service.h"
14 #include "chrome/browser/sync/profile_sync_service_factory.h" 15 #include "chrome/browser/sync/profile_sync_service_factory.h"
15 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
16 #include "chrome/browser/ui/browser_finder.h" 17 #include "chrome/browser/ui/browser_finder.h"
17 #include "chrome/browser/ui/browser_navigator.h" 18 #include "chrome/browser/ui/browser_navigator.h"
18 #include "chrome/browser/ui/browser_window.h" 19 #include "chrome/browser/ui/browser_window.h"
19 #include "chrome/browser/ui/singleton_tabs.h" 20 #include "chrome/browser/ui/singleton_tabs.h"
20 #include "chrome/browser/ui/tabs/tab_strip_model.h" 21 #include "chrome/browser/ui/tabs/tab_strip_model.h"
21 #include "chrome/browser/ui/webui/options/content_settings_handler.h" 22 #include "chrome/browser/ui/webui/options/content_settings_handler.h"
22 #include "chrome/browser/ui/webui/signin/login_ui_service.h" 23 #include "chrome/browser/ui/webui/signin/login_ui_service.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 ShowSingletonTabOverwritingNTP(browser, params); 178 ShowSingletonTabOverwritingNTP(browser, params);
178 } 179 }
179 180
180 void ShowSearchEngineSettings(Browser* browser) { 181 void ShowSearchEngineSettings(Browser* browser) {
181 content::RecordAction(UserMetricsAction("EditSearchEngines")); 182 content::RecordAction(UserMetricsAction("EditSearchEngines"));
182 ShowSettingsSubPage(browser, kSearchEnginesSubPage); 183 ShowSettingsSubPage(browser, kSearchEnginesSubPage);
183 } 184 }
184 185
185 void ShowBrowserSignin(Browser* browser, SyncPromoUI::Source source) { 186 void ShowBrowserSignin(Browser* browser, SyncPromoUI::Source source) {
186 Profile* original_profile = browser->profile()->GetOriginalProfile(); 187 Profile* original_profile = browser->profile()->GetOriginalProfile();
188 // Check if Signin to Chrome is allowed by the policy.
189 SigninManager* signin = SigninManagerFactory::GetForProfile(original_profile);
190 if (!signin->IsSigninAllowed())
191 return;
187 ProfileSyncService* service = 192 ProfileSyncService* service =
188 ProfileSyncServiceFactory::GetInstance()->GetForProfile( 193 ProfileSyncServiceFactory::GetInstance()->GetForProfile(
189 original_profile); 194 original_profile);
190 // If we're signed in, just show settings. 195 // If we're signed in, just show settings.
191 if (!service->signin()->GetAuthenticatedUsername().empty()) { 196 if (!service->signin()->GetAuthenticatedUsername().empty()) {
192 ShowSettings(browser); 197 ShowSettings(browser);
193 } else { 198 } else {
194 // If the browser's profile is an incognito profile, make sure to use 199 // If the browser's profile is an incognito profile, make sure to use
195 // a browser window from the original profile. The user cannot sign in 200 // a browser window from the original profile. The user cannot sign in
196 // from an incognito window. 201 // from an incognito window.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 const std::string& service, 233 const std::string& service,
229 const GURL& continue_url) { 234 const GURL& continue_url) {
230 GURL url(GaiaUrls::GetInstance()->service_login_url()); 235 GURL url(GaiaUrls::GetInstance()->service_login_url());
231 url = net::AppendQueryParameter(url, "service", service); 236 url = net::AppendQueryParameter(url, "service", service);
232 if (continue_url.is_valid()) 237 if (continue_url.is_valid())
233 url = net::AppendQueryParameter(url, "continue", continue_url.spec()); 238 url = net::AppendQueryParameter(url, "continue", continue_url.spec());
234 NavigateToSingletonTab(browser, url); 239 NavigateToSingletonTab(browser, url);
235 } 240 }
236 241
237 } // namespace chrome 242 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698