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/feature_list.h" | |
10 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
11 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
12 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
13 #include "base/threading/thread.h" | 14 #include "base/threading/thread.h" |
14 #include "base/threading/thread_restrictions.h" | 15 #include "base/threading/thread_restrictions.h" |
15 #include "build/build_config.h" | 16 #include "build/build_config.h" |
16 #include "components/devtools_http_handler/devtools_http_handler.h" | 17 #include "components/devtools_http_handler/devtools_http_handler.h" |
17 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
18 #include "content/public/browser/storage_partition.h" | 19 #include "content/public/browser/storage_partition.h" |
19 #include "content/public/common/content_switches.h" | 20 #include "content/public/common/content_switches.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
126 void ShellBrowserMainParts::PreEarlyInitialization() { | 127 void ShellBrowserMainParts::PreEarlyInitialization() { |
127 #if !defined(OS_CHROMEOS) && defined(USE_AURA) && defined(OS_LINUX) | 128 #if !defined(OS_CHROMEOS) && defined(USE_AURA) && defined(OS_LINUX) |
128 ui::InitializeInputMethodForTesting(); | 129 ui::InitializeInputMethodForTesting(); |
129 #endif | 130 #endif |
130 #if defined(OS_ANDROID) | 131 #if defined(OS_ANDROID) |
131 net::NetworkChangeNotifier::SetFactory( | 132 net::NetworkChangeNotifier::SetFactory( |
132 new net::NetworkChangeNotifierFactoryAndroid()); | 133 new net::NetworkChangeNotifierFactoryAndroid()); |
133 #endif | 134 #endif |
134 } | 135 } |
135 | 136 |
137 int ShellBrowserMainParts::PreCreateThreads() { | |
138 // The only case GetInstance() returns null should be when you are running a | |
139 // C++ test, in which case currently we do not support command line features. | |
140 // This allows Test::SetUp() to enable/disable features as necessary. See | |
141 // crbug.com/596021 for more details. | |
142 if (!base::FeatureList::GetInstance()) { | |
143 const base::CommandLine* command_line = | |
144 base::CommandLine::ForCurrentProcess(); | |
145 scoped_ptr<base::FeatureList> feature_list(new base::FeatureList); | |
146 feature_list->InitializeFromCommandLine( | |
147 command_line->GetSwitchValueASCII(switches::kEnableFeatures), | |
148 command_line->GetSwitchValueASCII(switches::kDisableFeatures)); | |
149 base::FeatureList::SetInstance(std::move(feature_list)); | |
Alexei Svitkine (slow)
2016/03/24 17:16:37
Instead of requiring every BrowserMainParts implem
Changwan Ryu
2016/03/28 07:09:27
Makes perfect sense that this should be done insid
Alexei Svitkine (slow)
2016/03/29 15:08:03
I did not mean that the two params should override
| |
150 } | |
151 return 0; | |
152 } | |
153 | |
136 void ShellBrowserMainParts::InitializeBrowserContexts() { | 154 void ShellBrowserMainParts::InitializeBrowserContexts() { |
137 set_browser_context(new ShellBrowserContext(false, net_log_.get())); | 155 set_browser_context(new ShellBrowserContext(false, net_log_.get())); |
138 set_off_the_record_browser_context( | 156 set_off_the_record_browser_context( |
139 new ShellBrowserContext(true, net_log_.get())); | 157 new ShellBrowserContext(true, net_log_.get())); |
140 } | 158 } |
141 | 159 |
142 void ShellBrowserMainParts::InitializeMessageLoopContext() { | 160 void ShellBrowserMainParts::InitializeMessageLoopContext() { |
143 Shell::CreateNewWindow(browser_context_.get(), | 161 Shell::CreateNewWindow(browser_context_.get(), |
144 GetStartupURL(), | 162 GetStartupURL(), |
145 NULL, | 163 NULL, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
189 device::BluetoothAdapterFactory::Shutdown(); | 207 device::BluetoothAdapterFactory::Shutdown(); |
190 bluez::BluezDBusManager::Shutdown(); | 208 bluez::BluezDBusManager::Shutdown(); |
191 chromeos::DBusThreadManager::Shutdown(); | 209 chromeos::DBusThreadManager::Shutdown(); |
192 #elif defined(OS_LINUX) | 210 #elif defined(OS_LINUX) |
193 device::BluetoothAdapterFactory::Shutdown(); | 211 device::BluetoothAdapterFactory::Shutdown(); |
194 bluez::DBusBluezManagerWrapperLinux::Shutdown(); | 212 bluez::DBusBluezManagerWrapperLinux::Shutdown(); |
195 #endif | 213 #endif |
196 } | 214 } |
197 | 215 |
198 } // namespace | 216 } // namespace |
OLD | NEW |