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

Unified 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: use USB_DEVICE_NAME instead of USB_DEVICE_PRODUCT_NAME in generated_resources.grd 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chrome_browser_main.cc
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc
index d9bf84879fd00ab9cd2318518260164b83a1760b..e58af0f607b3713b657b18fa9836689c818dbcf0 100644
--- a/chrome/browser/chrome_browser_main.cc
+++ b/chrome/browser/chrome_browser_main.cc
@@ -237,6 +237,11 @@
#include "ui/aura/env.h"
#endif // defined(USE_AURA)
+#if !defined(OS_ANDROID) && !defined(OS_IOS)
+#include "chrome/browser/chrome_webusb_browser_client.h"
+#include "components/webusb/webusb_detector.h"
+#endif
+
using content::BrowserThread;
namespace {
@@ -1179,6 +1184,15 @@ void ChromeBrowserMainParts::PostBrowserStart() {
base::TimeDelta::FromMinutes(1));
#endif // defined(ENABLE_WEBRTC)
+#if !defined(OS_ANDROID) && !defined(OS_IOS)
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableWebUsbNotifications)) {
+ webusb_browser_client_.reset(new ChromeWebUsbBrowserClient());
+ webusb_detector_.reset(
+ new webusb::WebUsbDetector(webusb_browser_client_.get()));
+ }
+#endif
+
// At this point, StartupBrowserCreator::Start has run creating initial
// browser windows and tabs, but no progress has been made in loading
// content as the main message loop hasn't started processing tasks yet.
@@ -1775,6 +1789,11 @@ void ChromeBrowserMainParts::PostMainMessageLoopRun() {
// shut down.
process_power_collector_.reset();
+#if !defined(OS_IOS)
+ webusb_browser_client_.reset();
+ webusb_detector_.reset();
stevenjb 2015/09/09 19:35:26 Note: We should really reset the detector before t
juncai 2015/09/09 20:30:29 Done in a new patch.
+#endif
+
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
chrome_extra_parts_[i]->PostMainMessageLoopRun();

Powered by Google App Engine
This is Rietveld 408576698