diff options
author | reillyg <reillyg@chromium.org> | 2014-08-28 18:58:43 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-08-29 01:59:51 +0000 |
commit | e471fab8c731cfc2eacceca8cc5be524c2d6f4b4 (patch) | |
tree | 3ecc233a2dc5c66b1f980e335f1a92f027f2d95f /device/core/device_client.h | |
parent | a859ef1cc6d20bd833c84cd2d126cf49440b16f7 (diff) | |
download | chromium_src-e471fab8c731cfc2eacceca8cc5be524c2d6f4b4.zip chromium_src-e471fab8c731cfc2eacceca8cc5be524c2d6f4b4.tar.gz chromium_src-e471fab8c731cfc2eacceca8cc5be524c2d6f4b4.tar.bz2 |
Remove BrowserThread dependency from usb_service.
Instead of explicitly depending on specific browser threads the USB
service can assume that it is instantiated on BrowserThread::FILE (or
equivalent) and save a TaskRunner reference from this instantiation for
later use when called from other threads.
To reach BrowserThread::UI (required for DBus on Chrome OS) a reference
to the appropriate TaskRunner must be provided when calling
UsbService::GetInstance().
BUG=
Review URL: https://codereview.chromium.org/507503002
Cr-Commit-Position: refs/heads/master@{#292546}
Diffstat (limited to 'device/core/device_client.h')
-rw-r--r-- | device/core/device_client.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/device/core/device_client.h b/device/core/device_client.h new file mode 100644 index 0000000..d8d938b --- /dev/null +++ b/device/core/device_client.h @@ -0,0 +1,39 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef DEVICE_CORE_DEVICE_CLIENT_H_ +#define DEVICE_CORE_DEVICE_CLIENT_H_ + +#include "base/macros.h" + +namespace usb_service { +class UsbService; +} + +namespace device { + +// Interface used by consumers of //device APIs to get pointers to the service +// singletons appropriate for a given embedding application. For an example see +// //chrome/browser/chrome_device_client.h. +class DeviceClient { + public: + // Construction sets the single instance. + DeviceClient(); + + // Destruction clears the single instance. + ~DeviceClient(); + + // Returns the single instance of |this|. + static DeviceClient* Get(); + + // Returns the UsbService instance for this embedder. + virtual usb_service::UsbService* GetUsbService(); + + private: + DISALLOW_COPY_AND_ASSIGN(DeviceClient); +}; + +} // namespace device + +#endif // DEVICE_CORE_DEVICE_CLIENT_H_ |