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

Side by Side Diff: chrome/browser/chrome_device_client.cc

Issue 1176383002: Revert of Introduce the devices Mojo app (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 | « chrome/browser/chrome_device_client.h ('k') | chrome/chrome_browser.gypi » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/chrome_device_client.h" 5 #include "chrome/browser/chrome_device_client.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/macros.h"
8 #include "content/public/browser/browser_thread.h" 9 #include "content/public/browser/browser_thread.h"
9 #include "device/hid/hid_service.h" 10 #include "device/hid/hid_service.h"
11 #include "device/usb/public/cpp/device_manager_delegate.h"
12 #include "device/usb/public/cpp/device_manager_factory.h"
13 #include "device/usb/public/interfaces/device.mojom.h"
10 #include "device/usb/usb_service.h" 14 #include "device/usb/usb_service.h"
11 15
12 using content::BrowserThread; 16 using content::BrowserThread;
13 17
18 namespace {
19
20 // DeviceManagerDelegate implementation which allows access to all devices.
21 class BrowserDeviceManagerDelegate : public device::usb::DeviceManagerDelegate {
22 public:
23 BrowserDeviceManagerDelegate() {}
24 ~BrowserDeviceManagerDelegate() override {}
25
26 private:
27 bool IsDeviceAllowed(const device::usb::DeviceInfo& device) override {
28 return true;
29 }
30
31 DISALLOW_COPY_AND_ASSIGN(BrowserDeviceManagerDelegate);
32 };
33
34 } // namespace
35
14 ChromeDeviceClient::ChromeDeviceClient() {} 36 ChromeDeviceClient::ChromeDeviceClient() {}
15 37
16 ChromeDeviceClient::~ChromeDeviceClient() {} 38 ChromeDeviceClient::~ChromeDeviceClient() {}
17 39
18 device::UsbService* ChromeDeviceClient::GetUsbService() { 40 device::UsbService* ChromeDeviceClient::GetUsbService() {
19 DCHECK_CURRENTLY_ON(BrowserThread::UI); 41 DCHECK_CURRENTLY_ON(BrowserThread::UI);
20 return device::UsbService::GetInstance( 42 return device::UsbService::GetInstance(
21 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); 43 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE));
22 } 44 }
23 45
46 void ChromeDeviceClient::ConnectToUSBDeviceManager(
47 mojo::InterfaceRequest<device::usb::DeviceManager> request) {
48 device::usb::DeviceManagerFactory::Build(
49 request.Pass(),
50 scoped_ptr<device::usb::DeviceManagerDelegate>(
51 new BrowserDeviceManagerDelegate));
52 }
53
24 device::HidService* ChromeDeviceClient::GetHidService() { 54 device::HidService* ChromeDeviceClient::GetHidService() {
25 DCHECK_CURRENTLY_ON(BrowserThread::UI); 55 DCHECK_CURRENTLY_ON(BrowserThread::UI);
26 return device::HidService::GetInstance( 56 return device::HidService::GetInstance(
27 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); 57 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE));
28 } 58 }
OLDNEW
« no previous file with comments | « chrome/browser/chrome_device_client.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698