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

Unified Diff: content/renderer/usb/web_usb_client_impl.cc

Issue 1371793004: Provide the DeviceManager service to the renderer directly, no app. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@interface_permission
Patch Set: Fix chrome_browser.gypi. 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
« no previous file with comments | « content/renderer/usb/web_usb_client_impl.h ('k') | device/devices_app/devices_app.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/usb/web_usb_client_impl.cc
diff --git a/content/renderer/usb/web_usb_client_impl.cc b/content/renderer/usb/web_usb_client_impl.cc
index 3d011fec548aec57305571618757f1c60533bc7c..a294cb5d81dd398e20d63f3c8eb445038401a0a0 100644
--- a/content/renderer/usb/web_usb_client_impl.cc
+++ b/content/renderer/usb/web_usb_client_impl.cc
@@ -10,11 +10,9 @@
#include "base/move.h"
#include "base/strings/utf_string_conversions.h"
#include "content/child/scoped_web_callbacks.h"
+#include "content/public/common/service_registry.h"
#include "content/renderer/usb/type_converters.h"
#include "content/renderer/usb/web_usb_device_impl.h"
-#include "device/devices_app/public/cpp/constants.h"
-#include "mojo/application/public/cpp/connect.h"
-#include "mojo/application/public/interfaces/shell.mojom.h"
#include "third_party/WebKit/public/platform/WebCallbacks.h"
#include "third_party/WebKit/public/platform/WebPassOwnPtr.h"
#include "third_party/WebKit/public/platform/modules/webusb/WebUSBDeviceFilter.h"
@@ -53,10 +51,8 @@ ScopedWebCallbacks<CallbacksType> MakeScopedUSBCallbacks(
void OnGetDevicesComplete(
ScopedWebCallbacks<blink::WebUSBClientGetDevicesCallbacks> scoped_callbacks,
- mojo::ServiceProvider* device_services,
+ device::usb::DeviceManager* device_manager,
mojo::Array<device::usb::DeviceInfoPtr> results) {
- device::usb::DeviceManagerPtr device_manager;
- mojo::ConnectToService(device_services, &device_manager);
blink::WebVector<blink::WebUSBDevice*>* devices =
new blink::WebVector<blink::WebUSBDevice*>(results.size());
for (size_t i = 0; i < results.size(); ++i) {
@@ -70,9 +66,10 @@ void OnGetDevicesComplete(
} // namespace
-WebUSBClientImpl::WebUSBClientImpl(mojo::ServiceProviderPtr device_services)
- : device_services_(device_services.Pass()) {
- mojo::ConnectToService(device_services_.get(), &device_manager_);
+WebUSBClientImpl::WebUSBClientImpl(content::ServiceRegistry* service_registry) {
+ service_registry->ConnectToRemoteService(mojo::GetProxy(&device_manager_));
+ device_manager_.set_connection_error_handler(
+ [this]() { LOG(ERROR) << "Device manager connection failed."; });
}
WebUSBClientImpl::~WebUSBClientImpl() {}
@@ -88,7 +85,7 @@ void WebUSBClientImpl::getDevices(
device_manager_->GetDevices(
options.Pass(),
base::Bind(&OnGetDevicesComplete, base::Passed(&scoped_callbacks),
- base::Unretained(device_services_.get())));
+ base::Unretained(device_manager_.get())));
}
void WebUSBClientImpl::requestDevice(
« no previous file with comments | « content/renderer/usb/web_usb_client_impl.h ('k') | device/devices_app/devices_app.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698