| 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/app/chrome_main_delegate.h" | 5 #include "chrome/app/chrome_main_delegate.h" |
| 6 | 6 |
| 7 #include "base/base_paths.h" | 7 #include "base/base_paths.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/cpu.h" | 9 #include "base/cpu.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/i18n/rtl.h" | 11 #include "base/i18n/rtl.h" |
| 12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
| 13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
| 14 #include "base/metrics/statistics_recorder.h" | 14 #include "base/metrics/statistics_recorder.h" |
| 15 #include "base/path_service.h" | 15 #include "base/path_service.h" |
| 16 #include "base/process/memory.h" | 16 #include "base/process/memory.h" |
| 17 #include "base/process/process_handle.h" | 17 #include "base/process/process_handle.h" |
| 18 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
| 19 #include "base/trace_event/trace_event_impl.h" | 19 #include "base/trace_event/trace_event_impl.h" |
| 20 #include "build/build_config.h" | 20 #include "build/build_config.h" |
| 21 #include "chrome/browser/chrome_content_browser_client.h" | 21 #include "chrome/browser/chrome_content_browser_client.h" |
| 22 #include "chrome/browser/defaults.h" | 22 #include "chrome/browser/defaults.h" |
| 23 #include "chrome/common/channel_info.h" |
| 23 #include "chrome/common/chrome_constants.h" | 24 #include "chrome/common/chrome_constants.h" |
| 24 #include "chrome/common/chrome_content_client.h" | 25 #include "chrome/common/chrome_content_client.h" |
| 25 #include "chrome/common/chrome_paths.h" | 26 #include "chrome/common/chrome_paths.h" |
| 26 #include "chrome/common/chrome_paths_internal.h" | 27 #include "chrome/common/chrome_paths_internal.h" |
| 27 #include "chrome/common/chrome_result_codes.h" | 28 #include "chrome/common/chrome_result_codes.h" |
| 28 #include "chrome/common/chrome_switches.h" | 29 #include "chrome/common/chrome_switches.h" |
| 29 #include "chrome/common/chrome_version_info.h" | |
| 30 #include "chrome/common/crash_keys.h" | 30 #include "chrome/common/crash_keys.h" |
| 31 #include "chrome/common/logging_chrome.h" | 31 #include "chrome/common/logging_chrome.h" |
| 32 #include "chrome/common/profiling.h" | 32 #include "chrome/common/profiling.h" |
| 33 #include "chrome/common/switch_utils.h" | 33 #include "chrome/common/switch_utils.h" |
| 34 #include "chrome/common/trace_event_args_whitelist.h" | 34 #include "chrome/common/trace_event_args_whitelist.h" |
| 35 #include "chrome/common/url_constants.h" | 35 #include "chrome/common/url_constants.h" |
| 36 #include "chrome/plugin/chrome_content_plugin_client.h" | 36 #include "chrome/plugin/chrome_content_plugin_client.h" |
| 37 #include "chrome/renderer/chrome_content_renderer_client.h" | 37 #include "chrome/renderer/chrome_content_renderer_client.h" |
| 38 #include "chrome/utility/chrome_content_utility_client.h" | 38 #include "chrome/utility/chrome_content_utility_client.h" |
| 39 #include "components/component_updater/component_updater_paths.h" | 39 #include "components/component_updater/component_updater_paths.h" |
| 40 #include "components/content_settings/core/common/content_settings_pattern.h" | 40 #include "components/content_settings/core/common/content_settings_pattern.h" |
| 41 #include "components/startup_metric_utils/startup_metric_utils.h" | 41 #include "components/startup_metric_utils/startup_metric_utils.h" |
| 42 #include "components/version_info/version_info.h" |
| 42 #include "content/public/common/content_client.h" | 43 #include "content/public/common/content_client.h" |
| 43 #include "content/public/common/content_paths.h" | 44 #include "content/public/common/content_paths.h" |
| 44 #include "extensions/common/constants.h" | 45 #include "extensions/common/constants.h" |
| 45 #include "ui/base/ui_base_switches.h" | 46 #include "ui/base/ui_base_switches.h" |
| 46 | 47 |
| 47 #if defined(OS_WIN) | 48 #if defined(OS_WIN) |
| 48 #include <atlbase.h> | 49 #include <atlbase.h> |
| 49 #include <malloc.h> | 50 #include <malloc.h> |
| 50 #include <algorithm> | 51 #include <algorithm> |
| 51 #include "chrome/app/close_handle_hook_win.h" | 52 #include "chrome/app/close_handle_hook_win.h" |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 process_type == switches::kGpuProcess || | 266 process_type == switches::kGpuProcess || |
| 266 #endif | 267 #endif |
| 267 process_type == switches::kRendererProcess || | 268 process_type == switches::kRendererProcess || |
| 268 process_type == switches::kUtilityProcess; | 269 process_type == switches::kUtilityProcess; |
| 269 } | 270 } |
| 270 | 271 |
| 271 #if defined(OS_POSIX) | 272 #if defined(OS_POSIX) |
| 272 // Check for --version and --product-version; return true if we encountered | 273 // Check for --version and --product-version; return true if we encountered |
| 273 // one of these switches and should exit now. | 274 // one of these switches and should exit now. |
| 274 bool HandleVersionSwitches(const base::CommandLine& command_line) { | 275 bool HandleVersionSwitches(const base::CommandLine& command_line) { |
| 275 const chrome::VersionInfo version_info; | |
| 276 | |
| 277 #if !defined(OS_MACOSX) | 276 #if !defined(OS_MACOSX) |
| 278 if (command_line.HasSwitch(switches::kProductVersion)) { | 277 if (command_line.HasSwitch(switches::kProductVersion)) { |
| 279 printf("%s\n", version_info.Version().c_str()); | 278 printf("%s\n", version_info::GetVersionNumber().c_str()); |
| 280 return true; | 279 return true; |
| 281 } | 280 } |
| 282 #endif | 281 #endif |
| 283 | 282 |
| 284 if (command_line.HasSwitch(switches::kVersion)) { | 283 if (command_line.HasSwitch(switches::kVersion)) { |
| 285 printf("%s %s %s\n", | 284 printf("%s %s %s\n", |
| 286 version_info.Name().c_str(), | 285 version_info::GetProductName().c_str(), |
| 287 version_info.Version().c_str(), | 286 version_info::GetVersionNumber().c_str(), |
| 288 chrome::VersionInfo::GetVersionStringModifier().c_str()); | 287 chrome::GetChannelString().c_str()); |
| 289 return true; | 288 return true; |
| 290 } | 289 } |
| 291 | 290 |
| 292 return false; | 291 return false; |
| 293 } | 292 } |
| 294 | 293 |
| 295 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) | 294 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) |
| 296 // Show the man page if --help or -h is on the command line. | 295 // Show the man page if --help or -h is on the command line. |
| 297 void HandleHelpSwitches(const base::CommandLine& command_line) { | 296 void HandleHelpSwitches(const base::CommandLine& command_line) { |
| 298 if (command_line.HasSwitch(switches::kHelp) || | 297 if (command_line.HasSwitch(switches::kHelp) || |
| (...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 973 content::ContentUtilityClient* | 972 content::ContentUtilityClient* |
| 974 ChromeMainDelegate::CreateContentUtilityClient() { | 973 ChromeMainDelegate::CreateContentUtilityClient() { |
| 975 #if defined(CHROME_MULTIPLE_DLL_BROWSER) | 974 #if defined(CHROME_MULTIPLE_DLL_BROWSER) |
| 976 return NULL; | 975 return NULL; |
| 977 #else | 976 #else |
| 978 return g_chrome_content_utility_client.Pointer(); | 977 return g_chrome_content_utility_client.Pointer(); |
| 979 #endif | 978 #endif |
| 980 } | 979 } |
| 981 | 980 |
| 982 bool ChromeMainDelegate::ShouldEnableProfilerRecording() { | 981 bool ChromeMainDelegate::ShouldEnableProfilerRecording() { |
| 983 switch (chrome::VersionInfo::GetChannel()) { | 982 switch (chrome::GetChannel()) { |
| 984 case version_info::Channel::UNKNOWN: | 983 case version_info::Channel::UNKNOWN: |
| 985 case version_info::Channel::CANARY: | 984 case version_info::Channel::CANARY: |
| 986 return true; | 985 return true; |
| 987 case version_info::Channel::DEV: | 986 case version_info::Channel::DEV: |
| 988 case version_info::Channel::BETA: | 987 case version_info::Channel::BETA: |
| 989 case version_info::Channel::STABLE: | 988 case version_info::Channel::STABLE: |
| 990 default: | 989 default: |
| 991 // Don't enable instrumentation. | 990 // Don't enable instrumentation. |
| 992 return false; | 991 return false; |
| 993 } | 992 } |
| 994 } | 993 } |
| OLD | NEW |