summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/api/hid/hid_connection_resource.h
blob: afd5ea827b363cfadc90a676c9e2db168d13edea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// 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 CHROME_BROWSER_EXTENSIONS_API_HID_HID_CONNECTION_RESOURCE_H_
#define CHROME_BROWSER_EXTENSIONS_API_HID_HID_CONNECTION_RESOURCE_H_

#include <string>

#include "base/memory/ref_counted.h"
#include "content/public/browser/browser_thread.h"
#include "device/hid/hid_connection.h"
#include "extensions/browser/api/api_resource.h"
#include "extensions/browser/api/api_resource_manager.h"

namespace extensions {

class HidConnectionResource : public ApiResource {
 public:
  HidConnectionResource(const std::string& owner_extension_id,
                        scoped_refptr<device::HidConnection> connection);
  virtual ~HidConnectionResource();

  scoped_refptr<device::HidConnection> connection() const {
    return connection_;
  }

 private:
  friend class ApiResourceManager<HidConnectionResource>;

  static const char* service_name() { return "HidConnectionResourceManager"; }

  static const content::BrowserThread::ID kThreadId =
      content::BrowserThread::FILE;

  scoped_refptr<device::HidConnection> connection_;

  DISALLOW_COPY_AND_ASSIGN(HidConnectionResource);
};

}  // namespace extensions

#endif  // CHROME_BROWSER_EXTENSIONS_API_HID_HID_CONNECTION_RESOURCE_H_