| 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/shell/shell_browser_main_parts.h" | 5 #include "content/shell/shell_browser_main_parts.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| 11 #include "base/threading/thread.h" | 11 #include "base/threading/thread.h" |
| 12 #include "base/threading/thread_restrictions.h" | 12 #include "base/threading/thread_restrictions.h" |
| 13 #include "cc/base/switches.h" | 13 #include "cc/base/switches.h" |
| 14 #include "content/public/browser/plugin_service.h" | |
| 15 #include "content/public/common/content_switches.h" | 14 #include "content/public/common/content_switches.h" |
| 16 #include "content/public/common/main_function_params.h" | 15 #include "content/public/common/main_function_params.h" |
| 17 #include "content/public/common/url_constants.h" | 16 #include "content/public/common/url_constants.h" |
| 18 #include "content/shell/common/shell_switches.h" | 17 #include "content/shell/common/shell_switches.h" |
| 19 #include "content/shell/shell.h" | 18 #include "content/shell/shell.h" |
| 20 #include "content/shell/shell_browser_context.h" | 19 #include "content/shell/shell_browser_context.h" |
| 21 #include "content/shell/shell_devtools_delegate.h" | 20 #include "content/shell/shell_devtools_delegate.h" |
| 22 #include "content/shell/shell_plugin_service_filter.h" | |
| 23 #include "googleurl/src/gurl.h" | 21 #include "googleurl/src/gurl.h" |
| 24 #include "grit/net_resources.h" | 22 #include "grit/net_resources.h" |
| 25 #include "net/base/net_module.h" | 23 #include "net/base/net_module.h" |
| 26 #include "net/base/net_util.h" | 24 #include "net/base/net_util.h" |
| 27 #include "ui/base/resource/resource_bundle.h" | 25 #include "ui/base/resource/resource_bundle.h" |
| 28 | 26 |
| 27 #if defined(ENABLE_PLUGINS) |
| 28 #include "content/public/browser/plugin_service.h" |
| 29 #include "content/shell/shell_plugin_service_filter.h" |
| 30 #endif |
| 31 |
| 29 #if defined(OS_ANDROID) | 32 #if defined(OS_ANDROID) |
| 30 #include "net/android/network_change_notifier_factory_android.h" | 33 #include "net/android/network_change_notifier_factory_android.h" |
| 31 #include "net/base/network_change_notifier.h" | 34 #include "net/base/network_change_notifier.h" |
| 32 #endif | 35 #endif |
| 33 | 36 |
| 34 #if defined(USE_AURA) && defined(USE_X11) | 37 #if defined(USE_AURA) && defined(USE_X11) |
| 35 #include "ui/base/touch/touch_factory_x11.h" | 38 #include "ui/base/touch/touch_factory_x11.h" |
| 36 #endif | 39 #endif |
| 37 | 40 |
| 38 namespace content { | 41 namespace content { |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 net::NetModule::SetResourceProvider(PlatformResourceProvider); | 119 net::NetModule::SetResourceProvider(PlatformResourceProvider); |
| 117 | 120 |
| 118 devtools_delegate_ = new ShellDevToolsDelegate(browser_context_.get()); | 121 devtools_delegate_ = new ShellDevToolsDelegate(browser_context_.get()); |
| 119 | 122 |
| 120 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) { | 123 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) { |
| 121 Shell::CreateNewWindow(browser_context_.get(), | 124 Shell::CreateNewWindow(browser_context_.get(), |
| 122 GetStartupURL(), | 125 GetStartupURL(), |
| 123 NULL, | 126 NULL, |
| 124 MSG_ROUTING_NONE, | 127 MSG_ROUTING_NONE, |
| 125 gfx::Size()); | 128 gfx::Size()); |
| 126 } else { | 129 } |
| 130 |
| 131 #if defined(ENABLE_PLUGINS) |
| 132 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) { |
| 127 PluginService* plugin_service = PluginService::GetInstance(); | 133 PluginService* plugin_service = PluginService::GetInstance(); |
| 128 plugin_service_filter_.reset(new ShellPluginServiceFilter); | 134 plugin_service_filter_.reset(new ShellPluginServiceFilter); |
| 129 plugin_service->SetFilter(plugin_service_filter_.get()); | 135 plugin_service->SetFilter(plugin_service_filter_.get()); |
| 130 } | 136 } |
| 137 #endif |
| 131 | 138 |
| 132 if (parameters_.ui_task) { | 139 if (parameters_.ui_task) { |
| 133 parameters_.ui_task->Run(); | 140 parameters_.ui_task->Run(); |
| 134 delete parameters_.ui_task; | 141 delete parameters_.ui_task; |
| 135 run_message_loop_ = false; | 142 run_message_loop_ = false; |
| 136 } | 143 } |
| 137 } | 144 } |
| 138 | 145 |
| 139 bool ShellBrowserMainParts::MainMessageLoopRun(int* result_code) { | 146 bool ShellBrowserMainParts::MainMessageLoopRun(int* result_code) { |
| 140 return !run_message_loop_; | 147 return !run_message_loop_; |
| 141 } | 148 } |
| 142 | 149 |
| 143 void ShellBrowserMainParts::PostMainMessageLoopRun() { | 150 void ShellBrowserMainParts::PostMainMessageLoopRun() { |
| 144 #if defined(USE_AURA) | 151 #if defined(USE_AURA) |
| 145 Shell::PlatformExit(); | 152 Shell::PlatformExit(); |
| 146 #endif | 153 #endif |
| 147 if (devtools_delegate_) | 154 if (devtools_delegate_) |
| 148 devtools_delegate_->Stop(); | 155 devtools_delegate_->Stop(); |
| 149 browser_context_.reset(); | 156 browser_context_.reset(); |
| 150 off_the_record_browser_context_.reset(); | 157 off_the_record_browser_context_.reset(); |
| 151 } | 158 } |
| 152 | 159 |
| 153 } // namespace | 160 } // namespace |
| OLD | NEW |