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 "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" | 16 #include "content/common/debug_util.h" |
| 17 #include "content/public/common/content_switches.h" | 17 #include "content/public/common/content_switches.h" |
| 18 #include "content/public/common/main_function_params.h" | 18 #include "content/public/common/main_function_params.h" |
| 19 | 19 |
| 20 #if defined(OS_WIN) | 20 #if defined(OS_WIN) |
| 21 #include "base/win/metro.h" | 21 #include "base/win/metro.h" |
| 22 #include "base/win/windows_version.h" | 22 #include "base/win/windows_version.h" |
| 23 #include "ui/base/ime/win/tsf_bridge.h" | |
| 23 #include "ui/base/win/scoped_ole_initializer.h" | 24 #include "ui/base/win/scoped_ole_initializer.h" |
| 24 #include "ui/base/ime/win/tsf_bridge.h" | |
| 25 #endif | 25 #endif |
| 26 | 26 |
| 27 bool g_exited_main_message_loop = false; | 27 bool g_exited_main_message_loop = false; |
| 28 | 28 |
| 29 namespace content { | 29 namespace content { |
| 30 | 30 |
| 31 class BrowserMainRunnerImpl : public BrowserMainRunner { | 31 class BrowserMainRunnerImpl : public BrowserMainRunner { |
| 32 public: | 32 public: |
| 33 BrowserMainRunnerImpl() | 33 BrowserMainRunnerImpl() |
| 34 : is_initialized_(false), | 34 : is_initialized_(false), |
| 35 is_shutdown_(false), | 35 is_shutdown_(false), |
| 36 created_threads_(false) { | 36 created_threads_(false) { |
| 37 } | 37 } |
| 38 | 38 |
| 39 virtual ~BrowserMainRunnerImpl() { | 39 virtual ~BrowserMainRunnerImpl() { |
| 40 if (is_initialized_ && !is_shutdown_) | 40 if (is_initialized_ && !is_shutdown_) |
| 41 Shutdown(); | 41 Shutdown(); |
| 42 } | 42 } |
| 43 | 43 |
| 44 virtual int Initialize(const MainFunctionParams& parameters) | 44 virtual int Initialize(const MainFunctionParams& parameters) |
| 45 OVERRIDE { | 45 OVERRIDE { |
| 46 TRACE_EVENT0("startup", "BrowserMainRunnerImpl::Initialize") | 46 TRACE_EVENT0("startup", "BrowserMainRunnerImpl::Initialize") |
| 47 is_initialized_ = true; | 47 is_initialized_ = true; |
| 48 | 48 |
| 49 #if !defined(OS_IOS) | 49 #if !defined(OS_IOS) |
| 50 // ChildProcess:: is a misnomer unless you consider context. Use | 50 // Use of --wait-for-debugger only makes sense when Chrome itself is a |
| 51 // of --wait-for-debugger only makes sense when Chrome itself is a | |
| 52 // child process (e.g. when launched by PyAuto). | 51 // child process (e.g. when launched by PyAuto). |
| 53 if (parameters.command_line.HasSwitch(switches::kWaitForDebugger)) | 52 if (parameters.command_line.HasSwitch(switches::kWaitForDebugger)) |
| 54 ChildProcess::WaitForDebugger("Browser"); | 53 WaitForDebugger("Browser"); |
|
jam
2013/06/05 16:54:58
actually, you can take out this whole section. thi
scottmg
2013/06/05 17:19:27
Done.
| |
| 55 #endif // !defined(OS_IOS) | 54 #endif // !defined(OS_IOS) |
| 56 | 55 |
| 57 #if defined(OS_WIN) | 56 #if defined(OS_WIN) |
| 58 if (parameters.command_line.HasSwitch( | 57 if (parameters.command_line.HasSwitch( |
| 59 switches::kEnableTextServicesFramework)) { | 58 switches::kEnableTextServicesFramework)) { |
| 60 base::win::SetForceToUseTSF(); | 59 base::win::SetForceToUseTSF(); |
| 61 } else if (base::win::GetVersion() < base::win::VERSION_VISTA) { | 60 } else if (base::win::GetVersion() < base::win::VERSION_VISTA) { |
| 62 // When "Extend support of advanced text services to all programs" | 61 // When "Extend support of advanced text services to all programs" |
| 63 // (a.k.a. Cicero Unaware Application Support; CUAS) is enabled on | 62 // (a.k.a. Cicero Unaware Application Support; CUAS) is enabled on |
| 64 // Windows XP and handwriting modules shipped with Office 2003 are | 63 // Windows XP and handwriting modules shipped with Office 2003 are |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 165 | 164 |
| 166 DISALLOW_COPY_AND_ASSIGN(BrowserMainRunnerImpl); | 165 DISALLOW_COPY_AND_ASSIGN(BrowserMainRunnerImpl); |
| 167 }; | 166 }; |
| 168 | 167 |
| 169 // static | 168 // static |
| 170 BrowserMainRunner* BrowserMainRunner::Create() { | 169 BrowserMainRunner* BrowserMainRunner::Create() { |
| 171 return new BrowserMainRunnerImpl(); | 170 return new BrowserMainRunnerImpl(); |
| 172 } | 171 } |
| 173 | 172 |
| 174 } // namespace content | 173 } // namespace content |
| OLD | NEW |