| 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 "content/public/browser/browser_main_runner.h" | 5 #include "content/public/browser/browser_main_runner.h" |
| 6 | 6 |
| 7 #include "base/allocator/allocator_shim.h" | 7 #include "base/allocator/allocator_shim.h" |
| 8 #include "base/base_switches.h" | 8 #include "base/base_switches.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
| 13 #include "base/metrics/statistics_recorder.h" | 13 #include "base/metrics/statistics_recorder.h" |
| 14 #include "content/browser/browser_main_loop.h" | 14 #include "content/browser/browser_main_loop.h" |
| 15 #include "content/browser/notification_service_impl.h" | 15 #include "content/browser/notification_service_impl.h" |
| 16 #include "content/common/child_process.h" | |
| 17 #include "content/public/common/content_switches.h" | 16 #include "content/public/common/content_switches.h" |
| 18 #include "content/public/common/main_function_params.h" | 17 #include "content/public/common/main_function_params.h" |
| 19 | 18 |
| 20 #if defined(OS_WIN) | 19 #if defined(OS_WIN) |
| 21 #include "base/win/metro.h" | 20 #include "base/win/metro.h" |
| 22 #include "base/win/windows_version.h" | 21 #include "base/win/windows_version.h" |
| 22 #include "ui/base/ime/win/tsf_bridge.h" |
| 23 #include "ui/base/win/scoped_ole_initializer.h" | 23 #include "ui/base/win/scoped_ole_initializer.h" |
| 24 #include "ui/base/ime/win/tsf_bridge.h" | |
| 25 #endif | 24 #endif |
| 26 | 25 |
| 27 bool g_exited_main_message_loop = false; | 26 bool g_exited_main_message_loop = false; |
| 28 | 27 |
| 29 namespace content { | 28 namespace content { |
| 30 | 29 |
| 31 class BrowserMainRunnerImpl : public BrowserMainRunner { | 30 class BrowserMainRunnerImpl : public BrowserMainRunner { |
| 32 public: | 31 public: |
| 33 BrowserMainRunnerImpl() | 32 BrowserMainRunnerImpl() |
| 34 : is_initialized_(false), | 33 : is_initialized_(false), |
| 35 is_shutdown_(false), | 34 is_shutdown_(false), |
| 36 created_threads_(false) { | 35 created_threads_(false) { |
| 37 } | 36 } |
| 38 | 37 |
| 39 virtual ~BrowserMainRunnerImpl() { | 38 virtual ~BrowserMainRunnerImpl() { |
| 40 if (is_initialized_ && !is_shutdown_) | 39 if (is_initialized_ && !is_shutdown_) |
| 41 Shutdown(); | 40 Shutdown(); |
| 42 } | 41 } |
| 43 | 42 |
| 44 virtual int Initialize(const MainFunctionParams& parameters) | 43 virtual int Initialize(const MainFunctionParams& parameters) |
| 45 OVERRIDE { | 44 OVERRIDE { |
| 46 TRACE_EVENT0("startup", "BrowserMainRunnerImpl::Initialize") | 45 TRACE_EVENT0("startup", "BrowserMainRunnerImpl::Initialize") |
| 47 is_initialized_ = true; | 46 is_initialized_ = true; |
| 48 | 47 |
| 49 #if !defined(OS_IOS) | |
| 50 // ChildProcess:: is a misnomer unless you consider context. Use | |
| 51 // of --wait-for-debugger only makes sense when Chrome itself is a | |
| 52 // child process (e.g. when launched by PyAuto). | |
| 53 if (parameters.command_line.HasSwitch(switches::kWaitForDebugger)) | |
| 54 ChildProcess::WaitForDebugger("Browser"); | |
| 55 #endif // !defined(OS_IOS) | |
| 56 | |
| 57 #if defined(OS_WIN) | 48 #if defined(OS_WIN) |
| 58 if (parameters.command_line.HasSwitch( | 49 if (parameters.command_line.HasSwitch( |
| 59 switches::kEnableTextServicesFramework)) { | 50 switches::kEnableTextServicesFramework)) { |
| 60 base::win::SetForceToUseTSF(); | 51 base::win::SetForceToUseTSF(); |
| 61 } else if (base::win::GetVersion() < base::win::VERSION_VISTA) { | 52 } else if (base::win::GetVersion() < base::win::VERSION_VISTA) { |
| 62 // When "Extend support of advanced text services to all programs" | 53 // When "Extend support of advanced text services to all programs" |
| 63 // (a.k.a. Cicero Unaware Application Support; CUAS) is enabled on | 54 // (a.k.a. Cicero Unaware Application Support; CUAS) is enabled on |
| 64 // Windows XP and handwriting modules shipped with Office 2003 are | 55 // Windows XP and handwriting modules shipped with Office 2003 are |
| 65 // installed, "penjpn.dll" and "skchui.dll" will be loaded and then crash | 56 // installed, "penjpn.dll" and "skchui.dll" will be loaded and then crash |
| 66 // unless a user installs Office 2003 SP3. To prevent these modules from | 57 // unless a user installs Office 2003 SP3. To prevent these modules from |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 | 156 |
| 166 DISALLOW_COPY_AND_ASSIGN(BrowserMainRunnerImpl); | 157 DISALLOW_COPY_AND_ASSIGN(BrowserMainRunnerImpl); |
| 167 }; | 158 }; |
| 168 | 159 |
| 169 // static | 160 // static |
| 170 BrowserMainRunner* BrowserMainRunner::Create() { | 161 BrowserMainRunner* BrowserMainRunner::Create() { |
| 171 return new BrowserMainRunnerImpl(); | 162 return new BrowserMainRunnerImpl(); |
| 172 } | 163 } |
| 173 | 164 |
| 174 } // namespace content | 165 } // namespace content |
| OLD | NEW |