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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 url = GURL(kChromeHelpViaMenuURL); | 117 url = GURL(kChromeHelpViaMenuURL); |
118 break; | 118 break; |
119 case HELP_SOURCE_WEBUI: | 119 case HELP_SOURCE_WEBUI: |
120 url = GURL(kChromeHelpViaWebUIURL); | 120 url = GURL(kChromeHelpViaWebUIURL); |
121 break; | 121 break; |
122 default: | 122 default: |
123 NOTREACHED() << "Unhandled help source " << source; | 123 NOTREACHED() << "Unhandled help source " << source; |
124 } | 124 } |
125 scoped_ptr<ScopedTabbedBrowserDisplayer> displayer; | 125 scoped_ptr<ScopedTabbedBrowserDisplayer> displayer; |
126 if (!browser) { | 126 if (!browser) { |
127 displayer.reset( | 127 displayer.reset(new ScopedTabbedBrowserDisplayer(profile)); |
128 new ScopedTabbedBrowserDisplayer(profile, host_desktop_type)); | |
129 browser = displayer->browser(); | 128 browser = displayer->browser(); |
130 } | 129 } |
131 ShowSingletonTab(browser, url); | 130 ShowSingletonTab(browser, url); |
132 #endif | 131 #endif |
133 } | 132 } |
134 | 133 |
135 std::string GenerateContentSettingsExceptionsSubPage(ContentSettingsType type) { | 134 std::string GenerateContentSettingsExceptionsSubPage(ContentSettingsType type) { |
136 return kContentSettingsExceptionsSubPage + std::string(kHashMark) + | 135 return kContentSettingsExceptionsSubPage + std::string(kHashMark) + |
137 options::ContentSettingsHandler::ContentSettingsTypeToGroupName(type); | 136 options::ContentSettingsHandler::ContentSettingsTypeToGroupName(type); |
138 } | 137 } |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 void ShowSettingsSubPageForProfile(Profile* profile, | 279 void ShowSettingsSubPageForProfile(Profile* profile, |
281 const std::string& sub_page) { | 280 const std::string& sub_page) { |
282 if (::switches::SettingsWindowEnabled()) { | 281 if (::switches::SettingsWindowEnabled()) { |
283 content::RecordAction(base::UserMetricsAction("ShowOptions")); | 282 content::RecordAction(base::UserMetricsAction("ShowOptions")); |
284 SettingsWindowManager::GetInstance()->ShowChromePageForProfile( | 283 SettingsWindowManager::GetInstance()->ShowChromePageForProfile( |
285 profile, GetSettingsUrl(sub_page)); | 284 profile, GetSettingsUrl(sub_page)); |
286 return; | 285 return; |
287 } | 286 } |
288 Browser* browser = chrome::FindTabbedBrowser(profile, false); | 287 Browser* browser = chrome::FindTabbedBrowser(profile, false); |
289 if (!browser) { | 288 if (!browser) { |
290 browser = new Browser( | 289 browser = new Browser(Browser::CreateParams(profile)); |
291 Browser::CreateParams(profile, chrome::HOST_DESKTOP_TYPE_NATIVE)); | |
292 } | 290 } |
293 ShowSettingsSubPageInTabbedBrowser(browser, sub_page); | 291 ShowSettingsSubPageInTabbedBrowser(browser, sub_page); |
294 } | 292 } |
295 | 293 |
296 void ShowSettingsSubPageInTabbedBrowser(Browser* browser, | 294 void ShowSettingsSubPageInTabbedBrowser(Browser* browser, |
297 const std::string& sub_page) { | 295 const std::string& sub_page) { |
298 content::RecordAction(UserMetricsAction("ShowOptions")); | 296 content::RecordAction(UserMetricsAction("ShowOptions")); |
299 GURL gurl = GetSettingsUrl(sub_page); | 297 GURL gurl = GetSettingsUrl(sub_page); |
300 NavigateParams params(GetSingletonTabNavigateParams(browser, gurl)); | 298 NavigateParams params(GetSingletonTabNavigateParams(browser, gurl)); |
301 params.path_behavior = NavigateParams::IGNORE_AND_NAVIGATE; | 299 params.path_behavior = NavigateParams::IGNORE_AND_NAVIGATE; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 SigninManagerBase* manager = | 363 SigninManagerBase* manager = |
366 SigninManagerFactory::GetForProfile(original_profile); | 364 SigninManagerFactory::GetForProfile(original_profile); |
367 DCHECK(manager->IsSigninAllowed()); | 365 DCHECK(manager->IsSigninAllowed()); |
368 // If the browser's profile is an incognito profile, make sure to use | 366 // If the browser's profile is an incognito profile, make sure to use |
369 // a browser window from the original profile. The user cannot sign in | 367 // a browser window from the original profile. The user cannot sign in |
370 // from an incognito window. | 368 // from an incognito window. |
371 bool switched_browser = false; | 369 bool switched_browser = false; |
372 scoped_ptr<ScopedTabbedBrowserDisplayer> displayer; | 370 scoped_ptr<ScopedTabbedBrowserDisplayer> displayer; |
373 if (browser->profile()->IsOffTheRecord()) { | 371 if (browser->profile()->IsOffTheRecord()) { |
374 switched_browser = true; | 372 switched_browser = true; |
375 displayer.reset(new ScopedTabbedBrowserDisplayer( | 373 displayer.reset(new ScopedTabbedBrowserDisplayer(original_profile)); |
376 original_profile, chrome::HOST_DESKTOP_TYPE_NATIVE)); | |
377 browser = displayer->browser(); | 374 browser = displayer->browser(); |
378 } | 375 } |
379 | 376 |
380 // Since the extension is a separate application, it might steal focus | 377 // Since the extension is a separate application, it might steal focus |
381 // away from Chrome, and accidentally close the avatar bubble. The same will | 378 // away from Chrome, and accidentally close the avatar bubble. The same will |
382 // happen if we had to switch browser windows to show the sign in page. In | 379 // happen if we had to switch browser windows to show the sign in page. In |
383 // this case, fallback to the full-tab signin page. | 380 // this case, fallback to the full-tab signin page. |
384 bool show_avatar_bubble = | 381 bool show_avatar_bubble = |
385 access_point != signin_metrics::AccessPoint::ACCESS_POINT_EXTENSIONS && | 382 access_point != signin_metrics::AccessPoint::ACCESS_POINT_EXTENSIONS && |
386 !switched_browser; | 383 !switched_browser; |
(...skipping 23 matching lines...) Expand all Loading... |
410 SigninManagerFactory::GetForProfile(original_profile); | 407 SigninManagerFactory::GetForProfile(original_profile); |
411 DCHECK(manager->IsSigninAllowed()); | 408 DCHECK(manager->IsSigninAllowed()); |
412 if (manager->IsAuthenticated()) | 409 if (manager->IsAuthenticated()) |
413 ShowSettings(browser); | 410 ShowSettings(browser); |
414 else | 411 else |
415 ShowBrowserSignin(browser, access_point); | 412 ShowBrowserSignin(browser, access_point); |
416 } | 413 } |
417 #endif | 414 #endif |
418 | 415 |
419 } // namespace chrome | 416 } // namespace chrome |
OLD | NEW |