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