OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/shell/browser/shell_browser_main_parts.h" | 5 #include "content/shell/browser/shell_browser_main_parts.h" |
6 | 6 |
7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
12 #include "base/threading/thread.h" | 12 #include "base/threading/thread.h" |
13 #include "base/threading/thread_restrictions.h" | 13 #include "base/threading/thread_restrictions.h" |
14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
15 #include "components/devtools_http_handler/devtools_http_handler.h" | |
16 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
16 #include "content/public/browser/devtools_agent_host.h" | |
17 #include "content/public/browser/storage_partition.h" | 17 #include "content/public/browser/storage_partition.h" |
18 #include "content/public/common/content_switches.h" | 18 #include "content/public/common/content_switches.h" |
19 #include "content/public/common/main_function_params.h" | 19 #include "content/public/common/main_function_params.h" |
20 #include "content/public/common/url_constants.h" | 20 #include "content/public/common/url_constants.h" |
21 #include "content/shell/android/shell_descriptors.h" | 21 #include "content/shell/android/shell_descriptors.h" |
22 #include "content/shell/browser/shell.h" | 22 #include "content/shell/browser/shell.h" |
23 #include "content/shell/browser/shell_access_token_store.h" | 23 #include "content/shell/browser/shell_access_token_store.h" |
24 #include "content/shell/browser/shell_browser_context.h" | 24 #include "content/shell/browser/shell_browser_context.h" |
25 #include "content/shell/browser/shell_devtools_manager_delegate.h" | 25 #include "content/shell/browser/shell_devtools_manager_delegate.h" |
26 #include "content/shell/browser/shell_net_log.h" | 26 #include "content/shell/browser/shell_net_log.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
105 return html_data; | 105 return html_data; |
106 } | 106 } |
107 return base::StringPiece(); | 107 return base::StringPiece(); |
108 } | 108 } |
109 | 109 |
110 } // namespace | 110 } // namespace |
111 | 111 |
112 ShellBrowserMainParts::ShellBrowserMainParts( | 112 ShellBrowserMainParts::ShellBrowserMainParts( |
113 const MainFunctionParams& parameters) | 113 const MainFunctionParams& parameters) |
114 : parameters_(parameters), | 114 : parameters_(parameters), |
115 run_message_loop_(true), | 115 run_message_loop_(true) { |
116 devtools_http_handler_(nullptr) { | |
117 } | 116 } |
118 | 117 |
119 ShellBrowserMainParts::~ShellBrowserMainParts() { | 118 ShellBrowserMainParts::~ShellBrowserMainParts() { |
120 DCHECK(!devtools_http_handler_); | |
121 #if defined(OS_ANDROID) | 119 #if defined(OS_ANDROID) |
122 breakpad::CrashDumpObserver::GetInstance()->UnregisterClient( | 120 breakpad::CrashDumpObserver::GetInstance()->UnregisterClient( |
123 crash_dump_manager_.get()); | 121 crash_dump_manager_.get()); |
124 #endif | 122 #endif |
125 } | 123 } |
126 | 124 |
127 #if !defined(OS_MACOSX) | 125 #if !defined(OS_MACOSX) |
128 void ShellBrowserMainParts::PreMainMessageLoopStart() { | 126 void ShellBrowserMainParts::PreMainMessageLoopStart() { |
129 #if defined(USE_AURA) && defined(USE_X11) | 127 #if defined(USE_AURA) && defined(USE_X11) |
130 ui::TouchFactory::SetTouchDeviceListFromCommandLine(); | 128 ui::TouchFactory::SetTouchDeviceListFromCommandLine(); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
189 } | 187 } |
190 #endif | 188 #endif |
191 | 189 |
192 void ShellBrowserMainParts::PreMainMessageLoopRun() { | 190 void ShellBrowserMainParts::PreMainMessageLoopRun() { |
193 net_log_.reset(new ShellNetLog("content_shell")); | 191 net_log_.reset(new ShellNetLog("content_shell")); |
194 InitializeBrowserContexts(); | 192 InitializeBrowserContexts(); |
195 device::GeolocationProvider::SetGeolocationDelegate( | 193 device::GeolocationProvider::SetGeolocationDelegate( |
196 new ShellGeolocationDelegate(browser_context())); | 194 new ShellGeolocationDelegate(browser_context())); |
197 Shell::Initialize(); | 195 Shell::Initialize(); |
198 net::NetModule::SetResourceProvider(PlatformResourceProvider); | 196 net::NetModule::SetResourceProvider(PlatformResourceProvider); |
199 | 197 ShellDevToolsManagerDelegate::StartHttpHandler(browser_context_.get()); |
200 devtools_http_handler_.reset( | |
201 ShellDevToolsManagerDelegate::CreateHttpHandler(browser_context_.get())); | |
202 | |
203 InitializeMessageLoopContext(); | 198 InitializeMessageLoopContext(); |
204 | 199 |
205 if (parameters_.ui_task) { | 200 if (parameters_.ui_task) { |
206 parameters_.ui_task->Run(); | 201 parameters_.ui_task->Run(); |
207 delete parameters_.ui_task; | 202 delete parameters_.ui_task; |
208 run_message_loop_ = false; | 203 run_message_loop_ = false; |
209 } | 204 } |
210 } | 205 } |
211 | 206 |
212 bool ShellBrowserMainParts::MainMessageLoopRun(int* result_code) { | 207 bool ShellBrowserMainParts::MainMessageLoopRun(int* result_code) { |
213 return !run_message_loop_; | 208 return !run_message_loop_; |
214 } | 209 } |
215 | 210 |
216 void ShellBrowserMainParts::PostMainMessageLoopRun() { | 211 void ShellBrowserMainParts::PostMainMessageLoopRun() { |
217 devtools_http_handler_.reset(); | 212 DevToolsAgentHost::StopRemoteDebuggingServer(); |
dgozman
2016/09/02 19:33:07
Remove this.
| |
213 ShellDevToolsManagerDelegate::StopHttpHandler(); | |
218 browser_context_.reset(); | 214 browser_context_.reset(); |
219 off_the_record_browser_context_.reset(); | 215 off_the_record_browser_context_.reset(); |
220 } | 216 } |
221 | 217 |
222 void ShellBrowserMainParts::PostDestroyThreads() { | 218 void ShellBrowserMainParts::PostDestroyThreads() { |
223 #if defined(OS_CHROMEOS) | 219 #if defined(OS_CHROMEOS) |
224 device::BluetoothAdapterFactory::Shutdown(); | 220 device::BluetoothAdapterFactory::Shutdown(); |
225 bluez::BluezDBusManager::Shutdown(); | 221 bluez::BluezDBusManager::Shutdown(); |
226 chromeos::DBusThreadManager::Shutdown(); | 222 chromeos::DBusThreadManager::Shutdown(); |
227 #elif defined(OS_LINUX) | 223 #elif defined(OS_LINUX) |
228 device::BluetoothAdapterFactory::Shutdown(); | 224 device::BluetoothAdapterFactory::Shutdown(); |
229 bluez::DBusBluezManagerWrapperLinux::Shutdown(); | 225 bluez::DBusBluezManagerWrapperLinux::Shutdown(); |
230 #endif | 226 #endif |
231 } | 227 } |
232 | 228 |
233 } // namespace | 229 } // namespace |
OLD | NEW |