Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(224)

Side by Side Diff: chrome/browser/chrome_browser_main.cc

Issue 1289423002: Add webusb notification UI code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updated code so that Chrome browser process owns WebUsbBrowserClient and WebUsbDetector objects Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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_browser_client_.reset(new ChromeWebUsbBrowserClient());
1176 webusb::WebUsbBrowserClient::Set(webusb_browser_client_.get());
1177 webusb_detector_.reset(new webusb::WebUsbDetector());
stevenjb 2015/08/28 16:55:05 Couldn't this just be: webusb_detector_.reset(new
juncai 2015/08/28 20:23:56 Done.
1178 }
1179 #endif
1180
1167 // At this point, StartupBrowserCreator::Start has run creating initial 1181 // At this point, StartupBrowserCreator::Start has run creating initial
1168 // browser windows and tabs, but no progress has been made in loading 1182 // 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. 1183 // 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 1184 // We setup to observe to the initial page load here to defer running
1171 // task posted via PostAfterStartupTask until its complete. 1185 // task posted via PostAfterStartupTask until its complete.
1172 AfterStartupTaskUtils::StartMonitoringStartup(); 1186 AfterStartupTaskUtils::StartMonitoringStartup();
1173 } 1187 }
1174 1188
1175 int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() { 1189 int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
1176 TRACE_EVENT0("startup", "ChromeBrowserMainParts::PreMainMessageLoopRunImpl"); 1190 TRACE_EVENT0("startup", "ChromeBrowserMainParts::PreMainMessageLoopRunImpl");
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
1816 chromeos::CrosSettings::Shutdown(); 1830 chromeos::CrosSettings::Shutdown();
1817 #endif // defined(OS_CHROMEOS) 1831 #endif // defined(OS_CHROMEOS)
1818 #endif // defined(OS_ANDROID) 1832 #endif // defined(OS_ANDROID)
1819 } 1833 }
1820 1834
1821 // Public members: 1835 // Public members:
1822 1836
1823 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { 1837 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) {
1824 chrome_extra_parts_.push_back(parts); 1838 chrome_extra_parts_.push_back(parts);
1825 } 1839 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698