diff options
author | kjellander <kjellander@chromium.org> | 2015-06-11 06:41:21 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-11 13:41:52 +0000 |
commit | 0e5fc2b42b268fab5d9ea3276235db58b7d61d1c (patch) | |
tree | 506e5ea9c115e0db708ce1304e4d3118a5bc3db7 /chrome/browser/chrome_device_client.cc | |
parent | 7fdcd8b0a4a9a8fd067f157670870653e1d9feea (diff) | |
download | chromium_src-0e5fc2b42b268fab5d9ea3276235db58b7d61d1c.zip chromium_src-0e5fc2b42b268fab5d9ea3276235db58b7d61d1c.tar.gz chromium_src-0e5fc2b42b268fab5d9ea3276235db58b7d61d1c.tar.bz2 |
Revert of Introduce the devices Mojo app (patchset #5 id:160001 of https://codereview.chromium.org/1165223004/)
Reason for revert:
This broke the Win 8 GN (dbg) and Win x64 GN (dbg) bots:
https://build.chromium.org/p/chromium.win/builders/Win8%20GN%20%28dbg%29/builds/7453
https://build.chromium.org/p/chromium.win/builders/Win%20x64%20GN%20%28dbg%29/builds/3219
Original issue's description:
> Introduce the devices Mojo app
>
> It's a small Mojo app that currently only hosts USB device
> services. This CL adds the app along with an apptest suite
> (run manually with mojo_runner mojo:devices_apptests).
>
> The app is hooked up to Chrome to run in the browser process,
> though there are currently no production code paths which
> cause the app to launch.
>
> BUG=498557
>
> Committed: https://crrev.com/ed800dc138edfa261aa766281b96f736ff9824f6
> Cr-Commit-Position: refs/heads/master@{#333899}
TBR=reillyg@chromium.org,sky@chromium.org,rockot@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=498557
Review URL: https://codereview.chromium.org/1176383002
Cr-Commit-Position: refs/heads/master@{#333942}
Diffstat (limited to 'chrome/browser/chrome_device_client.cc')
-rw-r--r-- | chrome/browser/chrome_device_client.cc | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/chrome/browser/chrome_device_client.cc b/chrome/browser/chrome_device_client.cc index 835a4c3..d0a31a6 100644 --- a/chrome/browser/chrome_device_client.cc +++ b/chrome/browser/chrome_device_client.cc @@ -5,12 +5,34 @@ #include "chrome/browser/chrome_device_client.h" #include "base/logging.h" +#include "base/macros.h" #include "content/public/browser/browser_thread.h" #include "device/hid/hid_service.h" +#include "device/usb/public/cpp/device_manager_delegate.h" +#include "device/usb/public/cpp/device_manager_factory.h" +#include "device/usb/public/interfaces/device.mojom.h" #include "device/usb/usb_service.h" using content::BrowserThread; +namespace { + +// DeviceManagerDelegate implementation which allows access to all devices. +class BrowserDeviceManagerDelegate : public device::usb::DeviceManagerDelegate { + public: + BrowserDeviceManagerDelegate() {} + ~BrowserDeviceManagerDelegate() override {} + + private: + bool IsDeviceAllowed(const device::usb::DeviceInfo& device) override { + return true; + } + + DISALLOW_COPY_AND_ASSIGN(BrowserDeviceManagerDelegate); +}; + +} // namespace + ChromeDeviceClient::ChromeDeviceClient() {} ChromeDeviceClient::~ChromeDeviceClient() {} @@ -21,6 +43,14 @@ device::UsbService* ChromeDeviceClient::GetUsbService() { BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); } +void ChromeDeviceClient::ConnectToUSBDeviceManager( + mojo::InterfaceRequest<device::usb::DeviceManager> request) { + device::usb::DeviceManagerFactory::Build( + request.Pass(), + scoped_ptr<device::usb::DeviceManagerDelegate>( + new BrowserDeviceManagerDelegate)); +} + device::HidService* ChromeDeviceClient::GetHidService() { DCHECK_CURRENTLY_ON(BrowserThread::UI); return device::HidService::GetInstance( |