Chromium Code Reviews| 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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| 11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "base/metrics/statistics_recorder.h" | 12 #include "base/metrics/statistics_recorder.h" |
| 13 #include "base/metrics/stats_counters.h" | 13 #include "base/metrics/stats_counters.h" |
| 14 #include "base/path_service.h" | 14 #include "base/path_service.h" |
| 15 #include "base/process/memory.h" | 15 #include "base/process/memory.h" |
| 16 #include "base/process/process_handle.h" | 16 #include "base/process/process_handle.h" |
| 17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
| 18 #include "chrome/browser/chrome_content_browser_client.h" | 18 #include "chrome/browser/chrome_content_browser_client.h" |
| 19 #include "chrome/browser/defaults.h" | 19 #include "chrome/browser/defaults.h" |
| 20 #include "chrome/browser/user_data_dir_extractor.h" | |
| 20 #include "chrome/common/chrome_constants.h" | 21 #include "chrome/common/chrome_constants.h" |
| 21 #include "chrome/common/chrome_content_client.h" | 22 #include "chrome/common/chrome_content_client.h" |
| 22 #include "chrome/common/chrome_paths.h" | 23 #include "chrome/common/chrome_paths.h" |
| 23 #include "chrome/common/chrome_switches.h" | 24 #include "chrome/common/chrome_switches.h" |
| 24 #include "chrome/common/chrome_version_info.h" | 25 #include "chrome/common/chrome_version_info.h" |
| 25 #include "chrome/common/crash_keys.h" | 26 #include "chrome/common/crash_keys.h" |
| 26 #include "chrome/common/logging_chrome.h" | 27 #include "chrome/common/logging_chrome.h" |
| 27 #include "chrome/common/profiling.h" | 28 #include "chrome/common/profiling.h" |
| 28 #include "chrome/common/url_constants.h" | 29 #include "chrome/common/url_constants.h" |
| 29 #include "chrome/plugin/chrome_content_plugin_client.h" | 30 #include "chrome/plugin/chrome_content_plugin_client.h" |
| 30 #include "chrome/renderer/chrome_content_renderer_client.h" | 31 #include "chrome/renderer/chrome_content_renderer_client.h" |
| 31 #include "chrome/utility/chrome_content_utility_client.h" | 32 #include "chrome/utility/chrome_content_utility_client.h" |
| 32 #include "components/nacl/common/nacl_switches.h" | 33 #include "components/nacl/common/nacl_switches.h" |
| 33 #include "components/startup_metric_utils/startup_metric_utils.h" | 34 #include "components/startup_metric_utils/startup_metric_utils.h" |
| 34 #include "content/public/common/content_client.h" | 35 #include "content/public/common/content_client.h" |
| 35 #include "content/public/common/content_paths.h" | 36 #include "content/public/common/content_paths.h" |
| 37 #include "content/public/common/main_function_params.h" | |
| 36 #include "ui/base/ui_base_switches.h" | 38 #include "ui/base/ui_base_switches.h" |
| 37 | 39 |
| 38 #if defined(OS_WIN) | 40 #if defined(OS_WIN) |
| 39 #include <atlbase.h> | 41 #include <atlbase.h> |
| 40 #include <malloc.h> | 42 #include <malloc.h> |
| 41 #include <algorithm> | 43 #include <algorithm> |
| 42 #include "base/strings/string_util.h" | 44 #include "base/strings/string_util.h" |
| 43 #include "chrome/common/child_process_logging.h" | 45 #include "chrome/common/child_process_logging.h" |
| 44 #include "sandbox/win/src/sandbox.h" | 46 #include "sandbox/win/src/sandbox.h" |
| 45 #include "tools/memory_watcher/memory_watcher.h" | 47 #include "tools/memory_watcher/memory_watcher.h" |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 571 chrome::GetVersionedDirectory(). | 573 chrome::GetVersionedDirectory(). |
| 572 Append(chrome::kHelperProcessExecutablePath)); | 574 Append(chrome::kHelperProcessExecutablePath)); |
| 573 | 575 |
| 574 InitMacCrashReporter(command_line, process_type); | 576 InitMacCrashReporter(command_line, process_type); |
| 575 #endif | 577 #endif |
| 576 | 578 |
| 577 #if defined(OS_WIN) | 579 #if defined(OS_WIN) |
| 578 child_process_logging::Init(); | 580 child_process_logging::Init(); |
| 579 #endif | 581 #endif |
| 580 | 582 |
| 583 // Initialize chrome::DIR_USER_DATA early on for service processes, etc. | |
| 584 chrome::GetUserDataDir(content::MainFunctionParams(command_line)); | |
|
Vitaly Buka (NO REVIEWS)
2014/02/20 19:58:17
Should we fail silently for service or any other c
msw
2014/02/20 20:58:48
Hmm, the dialog does show up a second time when I
| |
| 585 | |
| 581 stats_counter_timer_.reset(new base::StatsCounterTimer("Chrome.Init")); | 586 stats_counter_timer_.reset(new base::StatsCounterTimer("Chrome.Init")); |
| 582 startup_timer_.reset(new base::StatsScope<base::StatsCounterTimer> | 587 startup_timer_.reset(new base::StatsScope<base::StatsCounterTimer> |
| 583 (*stats_counter_timer_)); | 588 (*stats_counter_timer_)); |
| 584 | 589 |
| 585 // Enable the heap profiler as early as possible! | 590 // Enable the heap profiler as early as possible! |
| 586 EnableHeapProfiler(command_line); | 591 EnableHeapProfiler(command_line); |
| 587 | 592 |
| 588 // Enable Message Loop related state asap. | 593 // Enable Message Loop related state asap. |
| 589 if (command_line.HasSwitch(switches::kMessageLoopHistogrammer)) | 594 if (command_line.HasSwitch(switches::kMessageLoopHistogrammer)) |
| 590 base::MessageLoop::EnableHistogrammer(true); | 595 base::MessageLoop::EnableHistogrammer(true); |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 827 } | 832 } |
| 828 | 833 |
| 829 content::ContentUtilityClient* | 834 content::ContentUtilityClient* |
| 830 ChromeMainDelegate::CreateContentUtilityClient() { | 835 ChromeMainDelegate::CreateContentUtilityClient() { |
| 831 #if defined(CHROME_MULTIPLE_DLL_BROWSER) | 836 #if defined(CHROME_MULTIPLE_DLL_BROWSER) |
| 832 return NULL; | 837 return NULL; |
| 833 #else | 838 #else |
| 834 return g_chrome_content_utility_client.Pointer(); | 839 return g_chrome_content_utility_client.Pointer(); |
| 835 #endif | 840 #endif |
| 836 } | 841 } |
| OLD | NEW |