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

Side by Side Diff: content/renderer/usb/web_usb_client_impl.cc

Issue 1742753002: Rename web_usb_permission_bubble.cc/h and webusb_permission_bubble.mojom (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 9 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 | « content/renderer/usb/web_usb_client_impl.h ('k') | device/usb/public/interfaces/BUILD.gn » ('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 "content/renderer/usb/web_usb_client_impl.h" 5 #include "content/renderer/usb/web_usb_client_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 auto scoped_callbacks = MakeScopedUSBCallbacks(callbacks); 100 auto scoped_callbacks = MakeScopedUSBCallbacks(callbacks);
101 GetDeviceManager()->GetDevices( 101 GetDeviceManager()->GetDevices(
102 nullptr, 102 nullptr,
103 base::Bind(&OnGetDevicesComplete, base::Passed(&scoped_callbacks), 103 base::Bind(&OnGetDevicesComplete, base::Passed(&scoped_callbacks),
104 base::Unretained(device_manager_.get()))); 104 base::Unretained(device_manager_.get())));
105 } 105 }
106 106
107 void WebUSBClientImpl::requestDevice( 107 void WebUSBClientImpl::requestDevice(
108 const blink::WebUSBDeviceRequestOptions& options, 108 const blink::WebUSBDeviceRequestOptions& options,
109 blink::WebUSBClientRequestDeviceCallbacks* callbacks) { 109 blink::WebUSBClientRequestDeviceCallbacks* callbacks) {
110 if (!webusb_permission_bubble_) { 110 if (!chooser_service_) {
111 service_registry_->ConnectToRemoteService( 111 service_registry_->ConnectToRemoteService(
112 mojo::GetProxy(&webusb_permission_bubble_)); 112 mojo::GetProxy(&chooser_service_));
113 } 113 }
114 114
115 auto scoped_callbacks = MakeScopedUSBCallbacks(callbacks); 115 auto scoped_callbacks = MakeScopedUSBCallbacks(callbacks);
116 116
117 mojo::Array<device::usb::DeviceFilterPtr> device_filters = 117 mojo::Array<device::usb::DeviceFilterPtr> device_filters =
118 mojo::Array<device::usb::DeviceFilterPtr>::From(options.filters); 118 mojo::Array<device::usb::DeviceFilterPtr>::From(options.filters);
119 119
120 webusb_permission_bubble_->GetPermission( 120 chooser_service_->GetPermission(
121 std::move(device_filters), 121 std::move(device_filters),
122 base::Bind(&OnRequestDevicesComplete, base::Passed(&scoped_callbacks), 122 base::Bind(&OnRequestDevicesComplete, base::Passed(&scoped_callbacks),
123 base::Unretained(device_manager_.get()))); 123 base::Unretained(device_manager_.get())));
124 } 124 }
125 125
126 void WebUSBClientImpl::setObserver(Observer* observer) { 126 void WebUSBClientImpl::setObserver(Observer* observer) {
127 if (!observer_) { 127 if (!observer_) {
128 // Set up two sequential calls to GetDeviceChanges to avoid latency. 128 // Set up two sequential calls to GetDeviceChanges to avoid latency.
129 device::usb::DeviceManager* device_manager = GetDeviceManager(); 129 device::usb::DeviceManager* device_manager = GetDeviceManager();
130 device_manager->GetDeviceChanges(base::Bind( 130 device_manager->GetDeviceChanges(base::Bind(
(...skipping 29 matching lines...) Expand all
160 } 160 }
161 for (size_t i = 0; i < notification->devices_removed.size(); ++i) { 161 for (size_t i = 0; i < notification->devices_removed.size(); ++i) {
162 const device::usb::DeviceInfoPtr& device_info = 162 const device::usb::DeviceInfoPtr& device_info =
163 notification->devices_removed[i]; 163 notification->devices_removed[i];
164 observer_->onDeviceDisconnected(blink::adoptWebPtr(new WebUSBDeviceImpl( 164 observer_->onDeviceDisconnected(blink::adoptWebPtr(new WebUSBDeviceImpl(
165 nullptr, mojo::ConvertTo<blink::WebUSBDeviceInfo>(device_info)))); 165 nullptr, mojo::ConvertTo<blink::WebUSBDeviceInfo>(device_info))));
166 } 166 }
167 } 167 }
168 168
169 } // namespace content 169 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/usb/web_usb_client_impl.h ('k') | device/usb/public/interfaces/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698