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

Side by Side Diff: chrome/browser/usb/web_usb_detector.cc

Issue 2422403003: Disable WebUSB detector logic on Windows. (Closed)
Patch Set: Disable WebUSB detector unit tests on Windows. Created 4 years, 2 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
« no previous file with comments | « no previous file | chrome/browser/usb/web_usb_detector_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/usb/web_usb_detector.h" 5 #include "chrome/browser/usb/web_usb_detector.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 DISALLOW_COPY_AND_ASSIGN(WebUsbNotificationDelegate); 111 DISALLOW_COPY_AND_ASSIGN(WebUsbNotificationDelegate);
112 }; 112 };
113 113
114 } // namespace 114 } // namespace
115 115
116 WebUsbDetector::WebUsbDetector() : observer_(this) {} 116 WebUsbDetector::WebUsbDetector() : observer_(this) {}
117 117
118 WebUsbDetector::~WebUsbDetector() {} 118 WebUsbDetector::~WebUsbDetector() {}
119 119
120 void WebUsbDetector::Initialize() { 120 void WebUsbDetector::Initialize() {
121 // Disabled on Windows due to jank and hangs caused by enumerating devices.
122 // https://crbug.com/656702
123 #if !defined(OS_WIN)
121 SCOPED_UMA_HISTOGRAM_TIMER("WebUsb.DetectorInitialization"); 124 SCOPED_UMA_HISTOGRAM_TIMER("WebUsb.DetectorInitialization");
122 device::UsbService* usb_service = 125 device::UsbService* usb_service =
123 device::DeviceClient::Get()->GetUsbService(); 126 device::DeviceClient::Get()->GetUsbService();
124 if (!usb_service) 127 if (!usb_service)
125 return; 128 return;
126 129
127 observer_.Add(usb_service); 130 observer_.Add(usb_service);
131 #endif
128 } 132 }
129 133
130 void WebUsbDetector::OnDeviceAdded(scoped_refptr<device::UsbDevice> device) { 134 void WebUsbDetector::OnDeviceAdded(scoped_refptr<device::UsbDevice> device) {
131 const base::string16& product_name = device->product_string(); 135 const base::string16& product_name = device->product_string();
132 if (product_name.empty()) { 136 if (product_name.empty()) {
133 return; 137 return;
134 } 138 }
135 139
136 const GURL& landing_page = device->webusb_landing_page(); 140 const GURL& landing_page = device->webusb_landing_page();
137 if (!landing_page.is_valid() || !content::IsOriginSecure(landing_page)) { 141 if (!landing_page.is_valid() || !content::IsOriginSecure(landing_page)) {
(...skipping 25 matching lines...) Expand all
163 } 167 }
164 168
165 void WebUsbDetector::OnDeviceRemoved(scoped_refptr<device::UsbDevice> device) { 169 void WebUsbDetector::OnDeviceRemoved(scoped_refptr<device::UsbDevice> device) {
166 std::string notification_id = device->guid(); 170 std::string notification_id = device->guid();
167 message_center::MessageCenter* message_center = 171 message_center::MessageCenter* message_center =
168 message_center::MessageCenter::Get(); 172 message_center::MessageCenter::Get();
169 if (message_center->FindVisibleNotificationById(notification_id)) { 173 if (message_center->FindVisibleNotificationById(notification_id)) {
170 message_center->RemoveNotification(notification_id, false /* by_user */); 174 message_center->RemoveNotification(notification_id, false /* by_user */);
171 } 175 }
172 } 176 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/usb/web_usb_detector_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698