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

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: modified WebUsbBrowserClient::Set function Created 5 years, 4 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 885 matching lines...) Expand 10 before | Expand all | Expand 10 after
1133 #if defined(ENABLE_WEBRTC) 1138 #if defined(ENABLE_WEBRTC)
1134 // Set up a task to delete old WebRTC log files for all profiles. Use a delay 1139 // Set up a task to delete old WebRTC log files for all profiles. Use a delay
1135 // to reduce the impact on startup time. 1140 // to reduce the impact on startup time.
1136 BrowserThread::PostDelayedTask( 1141 BrowserThread::PostDelayedTask(
1137 BrowserThread::UI, 1142 BrowserThread::UI,
1138 FROM_HERE, 1143 FROM_HERE,
1139 base::Bind(&WebRtcLogUtil::DeleteOldWebRtcLogFilesForAllProfiles), 1144 base::Bind(&WebRtcLogUtil::DeleteOldWebRtcLogFilesForAllProfiles),
1140 base::TimeDelta::FromMinutes(1)); 1145 base::TimeDelta::FromMinutes(1));
1141 #endif // defined(ENABLE_WEBRTC) 1146 #endif // defined(ENABLE_WEBRTC)
1142 1147
1148 #if !defined(OS_ANDROID) && !defined(OS_IOS)
1149 scoped_ptr<webusb::WebUsbBrowserClient> webusb_browser_client_ptr(
1150 new ChromeWebUsbBrowserClient());
1151 if (webusb_browser_client_ptr->WebUsbNotificationEnabled()) {
Reilly Grant (use Gerrit) 2015/08/21 17:23:02 Why does this condition only guard the call to Set
juncai 2015/08/21 20:18:27 Done.
1152 webusb::WebUsbBrowserClient::Set(webusb_browser_client_ptr.release());
1153 }
1154 webusb::WebUsbDetector::GetInstance();
1155 #endif
1156
1143 // At this point, StartupBrowserCreator::Start has run creating initial 1157 // At this point, StartupBrowserCreator::Start has run creating initial
1144 // browser windows and tabs, but no progress has been made in loading 1158 // browser windows and tabs, but no progress has been made in loading
1145 // content as the main message loop hasn't started processing tasks yet. 1159 // content as the main message loop hasn't started processing tasks yet.
1146 // We setup to observe to the initial page load here to defer running 1160 // We setup to observe to the initial page load here to defer running
1147 // task posted via PostAfterStartupTask until its complete. 1161 // task posted via PostAfterStartupTask until its complete.
1148 AfterStartupTaskUtils::StartMonitoringStartup(); 1162 AfterStartupTaskUtils::StartMonitoringStartup();
1149 } 1163 }
1150 1164
1151 int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() { 1165 int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
1152 TRACE_EVENT0("startup", "ChromeBrowserMainParts::PreMainMessageLoopRunImpl"); 1166 TRACE_EVENT0("startup", "ChromeBrowserMainParts::PreMainMessageLoopRunImpl");
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
1792 chromeos::CrosSettings::Shutdown(); 1806 chromeos::CrosSettings::Shutdown();
1793 #endif // defined(OS_CHROMEOS) 1807 #endif // defined(OS_CHROMEOS)
1794 #endif // defined(OS_ANDROID) 1808 #endif // defined(OS_ANDROID)
1795 } 1809 }
1796 1810
1797 // Public members: 1811 // Public members:
1798 1812
1799 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { 1813 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) {
1800 chrome_extra_parts_.push_back(parts); 1814 chrome_extra_parts_.push_back(parts);
1801 } 1815 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698