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/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 content::RecordAction(UserMetricsAction("EditSearchEngines")); | 304 content::RecordAction(UserMetricsAction("EditSearchEngines")); |
305 ShowSettingsSubPage(browser, kSearchEnginesSubPage); | 305 ShowSettingsSubPage(browser, kSearchEnginesSubPage); |
306 } | 306 } |
307 | 307 |
308 void ShowBrowserSignin(Browser* browser, signin::Source source) { | 308 void ShowBrowserSignin(Browser* browser, signin::Source source) { |
309 Profile* original_profile = browser->profile()->GetOriginalProfile(); | 309 Profile* original_profile = browser->profile()->GetOriginalProfile(); |
310 SigninManagerBase* manager = | 310 SigninManagerBase* manager = |
311 SigninManagerFactory::GetForProfile(original_profile); | 311 SigninManagerFactory::GetForProfile(original_profile); |
312 DCHECK(manager->IsSigninAllowed()); | 312 DCHECK(manager->IsSigninAllowed()); |
313 // If we're signed in, just show settings. | 313 // If we're signed in, just show settings. |
314 if (!manager->GetAuthenticatedUsername().empty()) { | 314 if (manager->IsAuthenticated()) { |
315 ShowSettings(browser); | 315 ShowSettings(browser); |
316 } else { | 316 } else { |
317 // If the browser's profile is an incognito profile, make sure to use | 317 // If the browser's profile is an incognito profile, make sure to use |
318 // a browser window from the original profile. The user cannot sign in | 318 // a browser window from the original profile. The user cannot sign in |
319 // from an incognito window. | 319 // from an incognito window. |
320 scoped_ptr<ScopedTabbedBrowserDisplayer> displayer; | 320 scoped_ptr<ScopedTabbedBrowserDisplayer> displayer; |
321 if (browser->profile()->IsOffTheRecord()) { | 321 if (browser->profile()->IsOffTheRecord()) { |
322 displayer.reset(new ScopedTabbedBrowserDisplayer( | 322 displayer.reset(new ScopedTabbedBrowserDisplayer( |
323 original_profile, chrome::HOST_DESKTOP_TYPE_NATIVE)); | 323 original_profile, chrome::HOST_DESKTOP_TYPE_NATIVE)); |
324 browser = displayer->browser(); | 324 browser = displayer->browser(); |
325 } | 325 } |
326 | 326 |
327 NavigateToSingletonTab(browser, GURL(signin::GetPromoURL(source, false))); | 327 NavigateToSingletonTab(browser, GURL(signin::GetPromoURL(source, false))); |
328 DCHECK_GT(browser->tab_strip_model()->count(), 0); | 328 DCHECK_GT(browser->tab_strip_model()->count(), 0); |
329 } | 329 } |
330 } | 330 } |
331 | 331 |
332 } // namespace chrome | 332 } // namespace chrome |
OLD | NEW |