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/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/stringprintf.h" | 8 #include "base/stringprintf.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "chrome/browser/download/download_shelf.h" | 10 #include "chrome/browser/download/download_shelf.h" |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 | 193 |
194 void ShowSearchEngineSettings(Browser* browser) { | 194 void ShowSearchEngineSettings(Browser* browser) { |
195 content::RecordAction(UserMetricsAction("EditSearchEngines")); | 195 content::RecordAction(UserMetricsAction("EditSearchEngines")); |
196 ShowSettingsSubPage(browser, kSearchEnginesSubPage); | 196 ShowSettingsSubPage(browser, kSearchEnginesSubPage); |
197 } | 197 } |
198 | 198 |
199 void ShowBrowserSignin(Browser* browser, SyncPromoUI::Source source) { | 199 void ShowBrowserSignin(Browser* browser, SyncPromoUI::Source source) { |
200 Profile* original_profile = browser->profile()->GetOriginalProfile(); | 200 Profile* original_profile = browser->profile()->GetOriginalProfile(); |
201 SigninManager* manager = | 201 SigninManager* manager = |
202 SigninManagerFactory::GetForProfile(original_profile); | 202 SigninManagerFactory::GetForProfile(original_profile); |
| 203 DCHECK(manager->IsSigninAllowed()); |
203 // If we're signed in, just show settings. | 204 // If we're signed in, just show settings. |
204 if (!manager->GetAuthenticatedUsername().empty()) { | 205 if (!manager->GetAuthenticatedUsername().empty()) { |
205 ShowSettings(browser); | 206 ShowSettings(browser); |
206 } else { | 207 } else { |
207 // If the browser's profile is an incognito profile, make sure to use | 208 // If the browser's profile is an incognito profile, make sure to use |
208 // a browser window from the original profile. The user cannot sign in | 209 // a browser window from the original profile. The user cannot sign in |
209 // from an incognito window. | 210 // from an incognito window. |
210 if (browser->profile()->IsOffTheRecord()) { | 211 if (browser->profile()->IsOffTheRecord()) { |
211 browser = | 212 browser = |
212 chrome::FindOrCreateTabbedBrowser(original_profile, | 213 chrome::FindOrCreateTabbedBrowser(original_profile, |
(...skipping 30 matching lines...) Expand all Loading... |
243 const std::string& service, | 244 const std::string& service, |
244 const GURL& continue_url) { | 245 const GURL& continue_url) { |
245 GURL url(GaiaUrls::GetInstance()->service_login_url()); | 246 GURL url(GaiaUrls::GetInstance()->service_login_url()); |
246 url = net::AppendQueryParameter(url, "service", service); | 247 url = net::AppendQueryParameter(url, "service", service); |
247 if (continue_url.is_valid()) | 248 if (continue_url.is_valid()) |
248 url = net::AppendQueryParameter(url, "continue", continue_url.spec()); | 249 url = net::AppendQueryParameter(url, "continue", continue_url.spec()); |
249 NavigateToSingletonTab(browser, url); | 250 NavigateToSingletonTab(browser, url); |
250 } | 251 } |
251 | 252 |
252 } // namespace chrome | 253 } // namespace chrome |
OLD | NEW |