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

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

Issue 1624573004: Rename webusb_permission_bubble.mojom and move it to //content/public (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added content_common_mojo_bindings dep back to chrome_browser.gypi Created 4 years, 10 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 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 (!web_usb_permission_request_) {
111 service_registry_->ConnectToRemoteService( 111 service_registry_->ConnectToRemoteService(
112 mojo::GetProxy(&webusb_permission_bubble_)); 112 mojo::GetProxy(&web_usb_permission_request_));
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 web_usb_permission_request_->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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 notification->devices_removed[i]; 163 notification->devices_removed[i];
164 device::usb::DevicePtr device; 164 device::usb::DevicePtr device;
165 device_manager_->GetDevice(device_info->guid, mojo::GetProxy(&device)); 165 device_manager_->GetDevice(device_info->guid, mojo::GetProxy(&device));
166 observer_->onDeviceDisconnected(blink::adoptWebPtr(new WebUSBDeviceImpl( 166 observer_->onDeviceDisconnected(blink::adoptWebPtr(new WebUSBDeviceImpl(
167 std::move(device), 167 std::move(device),
168 mojo::ConvertTo<blink::WebUSBDeviceInfo>(device_info)))); 168 mojo::ConvertTo<blink::WebUSBDeviceInfo>(device_info))));
169 } 169 }
170 } 170 }
171 171
172 } // namespace content 172 } // namespace content
OLDNEW
« content/content_common_mojo_bindings.gyp ('K') | « content/renderer/usb/web_usb_client_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698