| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 params.path_behavior = NavigateParams::IGNORE_AND_NAVIGATE; | 75 params.path_behavior = NavigateParams::IGNORE_AND_NAVIGATE; |
| 76 ShowSingletonTabOverwritingNTP(browser, params); | 76 ShowSingletonTabOverwritingNTP(browser, params); |
| 77 } | 77 } |
| 78 | 78 |
| 79 // Shows either the help app or the appropriate help page for |source|. If | 79 // Shows either the help app or the appropriate help page for |source|. If |
| 80 // |browser| is NULL and the help page is used (vs the app), the help page is | 80 // |browser| is NULL and the help page is used (vs the app), the help page is |
| 81 // shown in the last active browser. If there is no such browser, a new browser | 81 // shown in the last active browser. If there is no such browser, a new browser |
| 82 // is created. | 82 // is created. |
| 83 void ShowHelpImpl(Browser* browser, | 83 void ShowHelpImpl(Browser* browser, |
| 84 Profile* profile, | 84 Profile* profile, |
| 85 HostDesktopType host_desktop_type, |
| 85 HelpSource source) { | 86 HelpSource source) { |
| 86 content::RecordAction(UserMetricsAction("ShowHelpTab")); | 87 content::RecordAction(UserMetricsAction("ShowHelpTab")); |
| 87 #if defined(OS_CHROMEOS) && defined(OFFICIAL_BUILD) | 88 #if defined(OS_CHROMEOS) && defined(OFFICIAL_BUILD) |
| 88 const extensions::Extension* extension = | 89 const extensions::Extension* extension = |
| 89 extensions::ExtensionRegistry::Get(profile)->GetExtensionById( | 90 extensions::ExtensionRegistry::Get(profile)->GetExtensionById( |
| 90 genius_app::kGeniusAppId, | 91 genius_app::kGeniusAppId, |
| 91 extensions::ExtensionRegistry::EVERYTHING); | 92 extensions::ExtensionRegistry::EVERYTHING); |
| 92 extensions::AppLaunchSource app_launch_source(extensions::SOURCE_UNTRACKED); | 93 extensions::AppLaunchSource app_launch_source(extensions::SOURCE_UNTRACKED); |
| 93 switch (source) { | 94 switch (source) { |
| 94 case HELP_SOURCE_KEYBOARD: | 95 case HELP_SOURCE_KEYBOARD: |
| 95 app_launch_source = extensions::SOURCE_KEYBOARD; | 96 app_launch_source = extensions::SOURCE_KEYBOARD; |
| 96 break; | 97 break; |
| 97 case HELP_SOURCE_MENU: | 98 case HELP_SOURCE_MENU: |
| 98 app_launch_source = extensions::SOURCE_SYSTEM_TRAY; | 99 app_launch_source = extensions::SOURCE_SYSTEM_TRAY; |
| 99 break; | 100 break; |
| 100 case HELP_SOURCE_WEBUI: | 101 case HELP_SOURCE_WEBUI: |
| 101 app_launch_source = extensions::SOURCE_ABOUT_PAGE; | 102 app_launch_source = extensions::SOURCE_ABOUT_PAGE; |
| 102 break; | 103 break; |
| 103 default: | 104 default: |
| 104 NOTREACHED() << "Unhandled help source" << source; | 105 NOTREACHED() << "Unhandled help source" << source; |
| 105 } | 106 } |
| 106 AppLaunchParams params(profile, extension, CURRENT_TAB, app_launch_source); | 107 AppLaunchParams params(profile, extension, CURRENT_TAB, host_desktop_type, |
| 108 app_launch_source); |
| 107 OpenApplication(params); | 109 OpenApplication(params); |
| 108 #else | 110 #else |
| 109 GURL url; | 111 GURL url; |
| 110 switch (source) { | 112 switch (source) { |
| 111 case HELP_SOURCE_KEYBOARD: | 113 case HELP_SOURCE_KEYBOARD: |
| 112 url = GURL(kChromeHelpViaKeyboardURL); | 114 url = GURL(kChromeHelpViaKeyboardURL); |
| 113 break; | 115 break; |
| 114 case HELP_SOURCE_MENU: | 116 case HELP_SOURCE_MENU: |
| 115 url = GURL(kChromeHelpViaMenuURL); | 117 url = GURL(kChromeHelpViaMenuURL); |
| 116 break; | 118 break; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 return; | 198 return; |
| 197 } | 199 } |
| 198 } | 200 } |
| 199 #endif | 201 #endif |
| 200 | 202 |
| 201 content::RecordAction(UserMetricsAction("AboutConflicts")); | 203 content::RecordAction(UserMetricsAction("AboutConflicts")); |
| 202 ShowSingletonTab(browser, GURL(kChromeUIConflictsURL)); | 204 ShowSingletonTab(browser, GURL(kChromeUIConflictsURL)); |
| 203 } | 205 } |
| 204 | 206 |
| 205 void ShowHelp(Browser* browser, HelpSource source) { | 207 void ShowHelp(Browser* browser, HelpSource source) { |
| 206 ShowHelpImpl(browser, browser->profile(), source); | 208 ShowHelpImpl( |
| 209 browser, browser->profile(), browser->host_desktop_type(), source); |
| 207 } | 210 } |
| 208 | 211 |
| 209 void ShowHelpForProfile(Profile* profile, HelpSource source) { | 212 void ShowHelpForProfile(Profile* profile, |
| 210 ShowHelpImpl(NULL, profile, source); | 213 HostDesktopType host_desktop_type, |
| 214 HelpSource source) { |
| 215 ShowHelpImpl(NULL, profile, host_desktop_type, source); |
| 211 } | 216 } |
| 212 | 217 |
| 213 void ShowPolicy(Browser* browser) { | 218 void ShowPolicy(Browser* browser) { |
| 214 ShowSingletonTab(browser, GURL(kChromeUIPolicyURL)); | 219 ShowSingletonTab(browser, GURL(kChromeUIPolicyURL)); |
| 215 } | 220 } |
| 216 | 221 |
| 217 void ShowSlow(Browser* browser) { | 222 void ShowSlow(Browser* browser) { |
| 218 #if defined(OS_CHROMEOS) | 223 #if defined(OS_CHROMEOS) |
| 219 ShowSingletonTab(browser, GURL(kChromeUISlowURL)); | 224 ShowSingletonTab(browser, GURL(kChromeUISlowURL)); |
| 220 #endif | 225 #endif |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 SigninManagerFactory::GetForProfile(original_profile); | 407 SigninManagerFactory::GetForProfile(original_profile); |
| 403 DCHECK(manager->IsSigninAllowed()); | 408 DCHECK(manager->IsSigninAllowed()); |
| 404 if (manager->IsAuthenticated()) | 409 if (manager->IsAuthenticated()) |
| 405 ShowSettings(browser); | 410 ShowSettings(browser); |
| 406 else | 411 else |
| 407 ShowBrowserSignin(browser, access_point); | 412 ShowBrowserSignin(browser, access_point); |
| 408 } | 413 } |
| 409 #endif | 414 #endif |
| 410 | 415 |
| 411 } // namespace chrome | 416 } // namespace chrome |
| OLD | NEW |