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 "chrome/browser/chrome_browser_main.h" | 5 #include "chrome/browser/chrome_browser_main.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
228 #endif // defined(ENABLE_RLZ) | 228 #endif // defined(ENABLE_RLZ) |
229 | 229 |
230 #if defined(ENABLE_WEBRTC) | 230 #if defined(ENABLE_WEBRTC) |
231 #include "chrome/browser/media/webrtc_log_util.h" | 231 #include "chrome/browser/media/webrtc_log_util.h" |
232 #endif // defined(ENABLE_WEBRTC) | 232 #endif // defined(ENABLE_WEBRTC) |
233 | 233 |
234 #if defined(USE_AURA) | 234 #if defined(USE_AURA) |
235 #include "ui/aura/env.h" | 235 #include "ui/aura/env.h" |
236 #endif // defined(USE_AURA) | 236 #endif // defined(USE_AURA) |
237 | 237 |
238 #if !defined(OS_ANDROID) && !defined(OS_IOS) | |
239 #include "chrome/browser/chrome_webusb_browser_client.h" | |
240 #include "components/webusb/webusb_detector.h" | |
241 #endif | |
242 | |
238 using content::BrowserThread; | 243 using content::BrowserThread; |
239 | 244 |
240 namespace { | 245 namespace { |
241 | 246 |
242 // This function provides some ways to test crash and assertion handling | 247 // This function provides some ways to test crash and assertion handling |
243 // behavior of the program. | 248 // behavior of the program. |
244 void HandleTestParameters(const base::CommandLine& command_line) { | 249 void HandleTestParameters(const base::CommandLine& command_line) { |
245 // This parameter causes a null pointer crash (crash reporter trigger). | 250 // This parameter causes a null pointer crash (crash reporter trigger). |
246 if (command_line.HasSwitch(switches::kBrowserCrashTest)) { | 251 if (command_line.HasSwitch(switches::kBrowserCrashTest)) { |
247 int* bad_pointer = NULL; | 252 int* bad_pointer = NULL; |
(...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1157 #if defined(ENABLE_WEBRTC) | 1162 #if defined(ENABLE_WEBRTC) |
1158 // Set up a task to delete old WebRTC log files for all profiles. Use a delay | 1163 // Set up a task to delete old WebRTC log files for all profiles. Use a delay |
1159 // to reduce the impact on startup time. | 1164 // to reduce the impact on startup time. |
1160 BrowserThread::PostDelayedTask( | 1165 BrowserThread::PostDelayedTask( |
1161 BrowserThread::UI, | 1166 BrowserThread::UI, |
1162 FROM_HERE, | 1167 FROM_HERE, |
1163 base::Bind(&WebRtcLogUtil::DeleteOldWebRtcLogFilesForAllProfiles), | 1168 base::Bind(&WebRtcLogUtil::DeleteOldWebRtcLogFilesForAllProfiles), |
1164 base::TimeDelta::FromMinutes(1)); | 1169 base::TimeDelta::FromMinutes(1)); |
1165 #endif // defined(ENABLE_WEBRTC) | 1170 #endif // defined(ENABLE_WEBRTC) |
1166 | 1171 |
1172 #if !defined(OS_ANDROID) && !defined(OS_IOS) | |
1173 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | |
1174 switches::kEnableWebUsbNotifications)) { | |
1175 webusb::WebUsbBrowserClient::Set(new ChromeWebUsbBrowserClient()); | |
1176 webusb::WebUsbDetector::Set(new webusb::WebUsbDetector()); | |
stevenjb
2015/08/27 16:56:02
Where do these get destroyed? Do they actually nee
Reilly Grant (use Gerrit)
2015/08/27 17:03:00
They should be owned by ChromeBrowserMainParts.
juncai
2015/08/28 01:15:52
Done.
| |
1177 } | |
1178 #endif | |
1179 | |
1167 // At this point, StartupBrowserCreator::Start has run creating initial | 1180 // At this point, StartupBrowserCreator::Start has run creating initial |
1168 // browser windows and tabs, but no progress has been made in loading | 1181 // browser windows and tabs, but no progress has been made in loading |
1169 // content as the main message loop hasn't started processing tasks yet. | 1182 // content as the main message loop hasn't started processing tasks yet. |
1170 // We setup to observe to the initial page load here to defer running | 1183 // We setup to observe to the initial page load here to defer running |
1171 // task posted via PostAfterStartupTask until its complete. | 1184 // task posted via PostAfterStartupTask until its complete. |
1172 AfterStartupTaskUtils::StartMonitoringStartup(); | 1185 AfterStartupTaskUtils::StartMonitoringStartup(); |
1173 } | 1186 } |
1174 | 1187 |
1175 int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() { | 1188 int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() { |
1176 TRACE_EVENT0("startup", "ChromeBrowserMainParts::PreMainMessageLoopRunImpl"); | 1189 TRACE_EVENT0("startup", "ChromeBrowserMainParts::PreMainMessageLoopRunImpl"); |
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1816 chromeos::CrosSettings::Shutdown(); | 1829 chromeos::CrosSettings::Shutdown(); |
1817 #endif // defined(OS_CHROMEOS) | 1830 #endif // defined(OS_CHROMEOS) |
1818 #endif // defined(OS_ANDROID) | 1831 #endif // defined(OS_ANDROID) |
1819 } | 1832 } |
1820 | 1833 |
1821 // Public members: | 1834 // Public members: |
1822 | 1835 |
1823 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { | 1836 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { |
1824 chrome_extra_parts_.push_back(parts); | 1837 chrome_extra_parts_.push_back(parts); |
1825 } | 1838 } |
OLD | NEW |