| OLD | NEW |
| 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 #ifndef CHROME_BROWSER_EXTENSIONS_API_GCD_PRIVATE_GCD_PRIVATE_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_GCD_PRIVATE_GCD_PRIVATE_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_GCD_PRIVATE_GCD_PRIVATE_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_GCD_PRIVATE_GCD_PRIVATE_API_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include <memory> |
| 9 |
| 9 #include "chrome/browser/extensions/chrome_extension_function.h" | 10 #include "chrome/browser/extensions/chrome_extension_function.h" |
| 10 #include "chrome/common/extensions/api/gcd_private.h" | 11 #include "chrome/common/extensions/api/gcd_private.h" |
| 11 #include "extensions/browser/browser_context_keyed_api_factory.h" | 12 #include "extensions/browser/browser_context_keyed_api_factory.h" |
| 12 | 13 |
| 13 namespace extensions { | 14 namespace extensions { |
| 14 | 15 |
| 15 class GcdPrivateAPIImpl; | 16 class GcdPrivateAPIImpl; |
| 16 | 17 |
| 17 class GcdPrivateAPI : public BrowserContextKeyedAPI { | 18 class GcdPrivateAPI : public BrowserContextKeyedAPI { |
| 18 public: | 19 public: |
| 19 explicit GcdPrivateAPI(content::BrowserContext* context); | 20 explicit GcdPrivateAPI(content::BrowserContext* context); |
| 20 ~GcdPrivateAPI() override; | 21 ~GcdPrivateAPI() override; |
| 21 | 22 |
| 22 // BrowserContextKeyedAPI implementation. | 23 // BrowserContextKeyedAPI implementation. |
| 23 static BrowserContextKeyedAPIFactory<GcdPrivateAPI>* GetFactoryInstance(); | 24 static BrowserContextKeyedAPIFactory<GcdPrivateAPI>* GetFactoryInstance(); |
| 24 | 25 |
| 25 private: | 26 private: |
| 26 friend class BrowserContextKeyedAPIFactory<GcdPrivateAPI>; | 27 friend class BrowserContextKeyedAPIFactory<GcdPrivateAPI>; |
| 27 friend class GcdPrivateAPIImpl; | 28 friend class GcdPrivateAPIImpl; |
| 28 | 29 |
| 29 // BrowserContextKeyedAPI implementation. | 30 // BrowserContextKeyedAPI implementation. |
| 30 static const char* service_name() { return "GcdPrivateAPI"; } | 31 static const char* service_name() { return "GcdPrivateAPI"; } |
| 31 | 32 |
| 32 scoped_ptr<GcdPrivateAPIImpl> impl_; | 33 std::unique_ptr<GcdPrivateAPIImpl> impl_; |
| 33 }; | 34 }; |
| 34 | 35 |
| 35 class GcdPrivateGetDeviceInfoFunction : public ChromeAsyncExtensionFunction { | 36 class GcdPrivateGetDeviceInfoFunction : public ChromeAsyncExtensionFunction { |
| 36 public: | 37 public: |
| 37 DECLARE_EXTENSION_FUNCTION("gcdPrivate.getDeviceInfo", | 38 DECLARE_EXTENSION_FUNCTION("gcdPrivate.getDeviceInfo", |
| 38 GCDPRIVATE_GETDEVICEINFO) | 39 GCDPRIVATE_GETDEVICEINFO) |
| 39 | 40 |
| 40 GcdPrivateGetDeviceInfoFunction(); | 41 GcdPrivateGetDeviceInfoFunction(); |
| 41 | 42 |
| 42 protected: | 43 protected: |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 protected: | 132 protected: |
| 132 ~GcdPrivateTerminateSessionFunction() override; | 133 ~GcdPrivateTerminateSessionFunction() override; |
| 133 | 134 |
| 134 // AsyncExtensionFunction overrides. | 135 // AsyncExtensionFunction overrides. |
| 135 bool RunAsync() override; | 136 bool RunAsync() override; |
| 136 }; | 137 }; |
| 137 | 138 |
| 138 } // namespace extensions | 139 } // namespace extensions |
| 139 | 140 |
| 140 #endif // CHROME_BROWSER_EXTENSIONS_API_GCD_PRIVATE_GCD_PRIVATE_API_H_ | 141 #endif // CHROME_BROWSER_EXTENSIONS_API_GCD_PRIVATE_GCD_PRIVATE_API_H_ |
| OLD | NEW |