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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 break; | 111 break; |
112 case HELP_SOURCE_MENU: | 112 case HELP_SOURCE_MENU: |
113 url = GURL(kChromeHelpViaMenuURL); | 113 url = GURL(kChromeHelpViaMenuURL); |
114 break; | 114 break; |
115 case HELP_SOURCE_WEBUI: | 115 case HELP_SOURCE_WEBUI: |
116 url = GURL(kChromeHelpViaWebUIURL); | 116 url = GURL(kChromeHelpViaWebUIURL); |
117 break; | 117 break; |
118 default: | 118 default: |
119 NOTREACHED() << "Unhandled help source " << source; | 119 NOTREACHED() << "Unhandled help source " << source; |
120 } | 120 } |
121 scoped_ptr<ScopedTabbedBrowserDisplayer> displayer; | 121 std::unique_ptr<ScopedTabbedBrowserDisplayer> displayer; |
122 if (!browser) { | 122 if (!browser) { |
123 displayer.reset(new ScopedTabbedBrowserDisplayer(profile)); | 123 displayer.reset(new ScopedTabbedBrowserDisplayer(profile)); |
124 browser = displayer->browser(); | 124 browser = displayer->browser(); |
125 } | 125 } |
126 ShowSingletonTab(browser, url); | 126 ShowSingletonTab(browser, url); |
127 #endif | 127 #endif |
128 } | 128 } |
129 | 129 |
130 std::string GenerateContentSettingsExceptionsSubPage(ContentSettingsType type) { | 130 std::string GenerateContentSettingsExceptionsSubPage(ContentSettingsType type) { |
131 return kContentSettingsExceptionsSubPage + std::string(kHashMark) + | 131 return kContentSettingsExceptionsSubPage + std::string(kHashMark) + |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 void ShowBrowserSignin(Browser* browser, | 346 void ShowBrowserSignin(Browser* browser, |
347 signin_metrics::AccessPoint access_point) { | 347 signin_metrics::AccessPoint access_point) { |
348 Profile* original_profile = browser->profile()->GetOriginalProfile(); | 348 Profile* original_profile = browser->profile()->GetOriginalProfile(); |
349 SigninManagerBase* manager = | 349 SigninManagerBase* manager = |
350 SigninManagerFactory::GetForProfile(original_profile); | 350 SigninManagerFactory::GetForProfile(original_profile); |
351 DCHECK(manager->IsSigninAllowed()); | 351 DCHECK(manager->IsSigninAllowed()); |
352 // If the browser's profile is an incognito profile, make sure to use | 352 // If the browser's profile is an incognito profile, make sure to use |
353 // a browser window from the original profile. The user cannot sign in | 353 // a browser window from the original profile. The user cannot sign in |
354 // from an incognito window. | 354 // from an incognito window. |
355 bool switched_browser = false; | 355 bool switched_browser = false; |
356 scoped_ptr<ScopedTabbedBrowserDisplayer> displayer; | 356 std::unique_ptr<ScopedTabbedBrowserDisplayer> displayer; |
357 if (browser->profile()->IsOffTheRecord()) { | 357 if (browser->profile()->IsOffTheRecord()) { |
358 switched_browser = true; | 358 switched_browser = true; |
359 displayer.reset(new ScopedTabbedBrowserDisplayer(original_profile)); | 359 displayer.reset(new ScopedTabbedBrowserDisplayer(original_profile)); |
360 browser = displayer->browser(); | 360 browser = displayer->browser(); |
361 } | 361 } |
362 | 362 |
363 // Since the extension is a separate application, it might steal focus | 363 // Since the extension is a separate application, it might steal focus |
364 // away from Chrome, and accidentally close the avatar bubble. The same will | 364 // away from Chrome, and accidentally close the avatar bubble. The same will |
365 // happen if we had to switch browser windows to show the sign in page. In | 365 // happen if we had to switch browser windows to show the sign in page. In |
366 // this case, fallback to the full-tab signin page. | 366 // this case, fallback to the full-tab signin page. |
(...skipping 26 matching lines...) Expand all Loading... |
393 SigninManagerFactory::GetForProfile(original_profile); | 393 SigninManagerFactory::GetForProfile(original_profile); |
394 DCHECK(manager->IsSigninAllowed()); | 394 DCHECK(manager->IsSigninAllowed()); |
395 if (manager->IsAuthenticated()) | 395 if (manager->IsAuthenticated()) |
396 ShowSettings(browser); | 396 ShowSettings(browser); |
397 else | 397 else |
398 ShowBrowserSignin(browser, access_point); | 398 ShowBrowserSignin(browser, access_point); |
399 } | 399 } |
400 #endif | 400 #endif |
401 | 401 |
402 } // namespace chrome | 402 } // namespace chrome |
OLD | NEW |