1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_EASY_UNLOCK_PRIVATE_EASY_UNLOCK_PRIVATE_CONNECTION_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_EASY_UNLOCK_PRIVATE_EASY_UNLOCK_PRIVATE_CONNECTION_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "extensions/browser/api/api_resource.h"
10 #include "extensions/browser/api/api_resource_manager.h"
12 namespace proximity_auth
{
14 } // namespace proximity_auth
16 namespace extensions
{
17 // An ApiResource wrapper for a proximity_auth::Connection.
18 class EasyUnlockPrivateConnection
: public ApiResource
{
20 EasyUnlockPrivateConnection(
22 const std::string
& owner_extension_id
,
23 scoped_ptr
<proximity_auth::Connection
> connection
);
24 ~EasyUnlockPrivateConnection() override
;
26 // Returns a pointer to the underlying connection object.
27 proximity_auth::Connection
* GetConnection() const;
29 // ApiResource override.
30 bool IsPersistent() const override
;
32 // This resource should be managed on the UI thread.
33 static const content::BrowserThread::ID kThreadId
=
34 content::BrowserThread::UI
;
37 friend class ApiResourceManager
<EasyUnlockPrivateConnection
>;
38 static const char* service_name() {
39 return "EasyUnlockPrivateConnectionManager";
42 // True, if this resource should be persistent.
45 // The connection is owned by this instance and will automatically disconnect
47 scoped_ptr
<proximity_auth::Connection
> connection_
;
49 DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateConnection
);
52 } // namespace extensions
54 #endif // CHROME_BROWSER_EXTENSIONS_API_EASY_UNLOCK_PRIVATE_EASY_UNLOCK_PRIVATE_CONNECTION_H_