| 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" |
| 11 #include "chrome/browser/download/download_shelf.h" | 11 #include "chrome/browser/download/download_shelf.h" |
| 12 #include "chrome/browser/extensions/extension_service.h" | |
| 13 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/profiles/profile_manager.h" | 13 #include "chrome/browser/profiles/profile_manager.h" |
| 15 #include "chrome/browser/signin/signin_manager_factory.h" | 14 #include "chrome/browser/signin/signin_manager_factory.h" |
| 16 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
| 17 #include "chrome/browser/ui/browser_finder.h" | 16 #include "chrome/browser/ui/browser_finder.h" |
| 18 #include "chrome/browser/ui/browser_navigator.h" | 17 #include "chrome/browser/ui/browser_navigator.h" |
| 19 #include "chrome/browser/ui/browser_window.h" | 18 #include "chrome/browser/ui/browser_window.h" |
| 20 #include "chrome/browser/ui/extensions/application_launch.h" | 19 #include "chrome/browser/ui/extensions/application_launch.h" |
| 21 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 20 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
| 22 #include "chrome/browser/ui/settings_window_manager.h" | 21 #include "chrome/browser/ui/settings_window_manager.h" |
| 23 #include "chrome/browser/ui/singleton_tabs.h" | 22 #include "chrome/browser/ui/singleton_tabs.h" |
| 24 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 23 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 25 #include "chrome/browser/ui/webui/options/content_settings_handler.h" | 24 #include "chrome/browser/ui/webui/options/content_settings_handler.h" |
| 26 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
| 27 #include "chrome/common/url_constants.h" | 26 #include "chrome/common/url_constants.h" |
| 28 #include "components/signin/core/browser/signin_manager.h" | 27 #include "components/signin/core/browser/signin_manager.h" |
| 29 #include "content/public/browser/user_metrics.h" | 28 #include "content/public/browser/user_metrics.h" |
| 30 #include "content/public/browser/web_contents.h" | 29 #include "content/public/browser/web_contents.h" |
| 31 #include "google_apis/gaia/gaia_urls.h" | 30 #include "google_apis/gaia/gaia_urls.h" |
| 32 #include "net/base/url_util.h" | 31 #include "net/base/url_util.h" |
| 33 | 32 |
| 34 #if defined(OS_WIN) | 33 #if defined(OS_WIN) |
| 35 #include "chrome/browser/enumerate_modules_model_win.h" | 34 #include "chrome/browser/enumerate_modules_model_win.h" |
| 36 #endif | 35 #endif |
| 37 | 36 |
| 38 #if defined(OS_CHROMEOS) | 37 #if defined(OS_CHROMEOS) |
| 39 #include "chrome/browser/chromeos/genius_app/app_id.h" | 38 #include "chrome/browser/chromeos/genius_app/app_id.h" |
| 40 #include "chromeos/chromeos_switches.h" | 39 #include "chromeos/chromeos_switches.h" |
| 40 #include "extensions/browser/extension_registry.h" |
| 41 #endif | 41 #endif |
| 42 | 42 |
| 43 using base::UserMetricsAction; | 43 using base::UserMetricsAction; |
| 44 | 44 |
| 45 namespace chrome { | 45 namespace chrome { |
| 46 namespace { | 46 namespace { |
| 47 | 47 |
| 48 const char kHashMark[] = "#"; | 48 const char kHashMark[] = "#"; |
| 49 | 49 |
| 50 void OpenBookmarkManagerWithHash(Browser* browser, | 50 void OpenBookmarkManagerWithHash(Browser* browser, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 72 // is created. | 72 // is created. |
| 73 void ShowHelpImpl(Browser* browser, | 73 void ShowHelpImpl(Browser* browser, |
| 74 Profile* profile, | 74 Profile* profile, |
| 75 HostDesktopType host_desktop_type, | 75 HostDesktopType host_desktop_type, |
| 76 HelpSource source) { | 76 HelpSource source) { |
| 77 content::RecordAction(UserMetricsAction("ShowHelpTab")); | 77 content::RecordAction(UserMetricsAction("ShowHelpTab")); |
| 78 #if defined(OS_CHROMEOS) && defined(OFFICIAL_BUILD) | 78 #if defined(OS_CHROMEOS) && defined(OFFICIAL_BUILD) |
| 79 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 79 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 80 if (!command_line->HasSwitch(chromeos::switches::kDisableGeniusApp)) { | 80 if (!command_line->HasSwitch(chromeos::switches::kDisableGeniusApp)) { |
| 81 const extensions::Extension* extension = | 81 const extensions::Extension* extension = |
| 82 profile->GetExtensionService()->GetInstalledExtension( | 82 extensions::ExtensionRegistry::Get(profile)->GetExtensionById( |
| 83 genius_app::kGeniusAppId); | 83 genius_app::kGeniusAppId, |
| 84 extensions::ExtensionRegistry::EVERYTHING); |
| 84 OpenApplication(AppLaunchParams(profile, extension, 0, host_desktop_type)); | 85 OpenApplication(AppLaunchParams(profile, extension, 0, host_desktop_type)); |
| 85 return; | 86 return; |
| 86 } | 87 } |
| 87 #endif | 88 #endif |
| 88 GURL url; | 89 GURL url; |
| 89 switch (source) { | 90 switch (source) { |
| 90 case HELP_SOURCE_KEYBOARD: | 91 case HELP_SOURCE_KEYBOARD: |
| 91 url = GURL(kChromeHelpViaKeyboardURL); | 92 url = GURL(kChromeHelpViaKeyboardURL); |
| 92 break; | 93 break; |
| 93 case HELP_SOURCE_MENU: | 94 case HELP_SOURCE_MENU: |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 original_profile, chrome::HOST_DESKTOP_TYPE_NATIVE)); | 323 original_profile, chrome::HOST_DESKTOP_TYPE_NATIVE)); |
| 323 browser = displayer->browser(); | 324 browser = displayer->browser(); |
| 324 } | 325 } |
| 325 | 326 |
| 326 NavigateToSingletonTab(browser, GURL(signin::GetPromoURL(source, false))); | 327 NavigateToSingletonTab(browser, GURL(signin::GetPromoURL(source, false))); |
| 327 DCHECK_GT(browser->tab_strip_model()->count(), 0); | 328 DCHECK_GT(browser->tab_strip_model()->count(), 0); |
| 328 } | 329 } |
| 329 } | 330 } |
| 330 | 331 |
| 331 } // namespace chrome | 332 } // namespace chrome |
| OLD | NEW |