Revert "Fix broken channel icon in chrome://help on CrOS" and try again
[chromium-blink-merge.git] / extensions / browser / api / api_resource.h
blobc696d46f46e9b7ad5daf72db7170bc4b59b31647
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
3 // found in the LICENSE file.
5 #ifndef EXTENSIONS_BROWSER_API_API_RESOURCE_H_
6 #define EXTENSIONS_BROWSER_API_API_RESOURCE_H_
8 #include "base/basictypes.h"
9 #include "base/memory/ref_counted.h"
10 #include "content/public/browser/browser_thread.h"
11 #include "extensions/common/extension.h"
13 namespace extensions {
15 // An ApiResource represents something that an extension API manages, such as a
16 // socket or a serial-port connection. Typically, an ApiResourceManager will
17 // control the lifetime of all ApiResources of a specific derived type.
18 class ApiResource {
19 public:
20 virtual ~ApiResource();
22 const std::string& owner_extension_id() const { return owner_extension_id_; }
24 // If this method returns |true|, the resource remains open when the
25 // owning extension is suspended due to inactivity.
26 virtual bool IsPersistent() const;
28 static const content::BrowserThread::ID kThreadId =
29 content::BrowserThread::IO;
31 protected:
32 explicit ApiResource(const std::string& owner_extension_id);
34 private:
35 // The extension that owns this resource.
36 const std::string owner_extension_id_;
38 DISALLOW_COPY_AND_ASSIGN(ApiResource);
41 } // namespace extensions
43 #endif // EXTENSIONS_BROWSER_API_API_RESOURCE_H_