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_COPRESENCE_COPRESENCE_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_COPRESENCE_COPRESENCE_API_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_COPRESENCE_COPRESENCE_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_COPRESENCE_COPRESENCE_API_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "chrome/browser/extensions/api/copresence/copresence_translations.h" | 14 #include "chrome/browser/extensions/api/copresence/copresence_translations.h" |
15 #include "chrome/browser/extensions/chrome_extension_function.h" | 15 #include "chrome/browser/extensions/chrome_extension_function.h" |
16 #include "chrome/common/extensions/api/copresence.h" | 16 #include "chrome/common/extensions/api/copresence.h" |
17 #include "components/copresence/public/copresence_delegate.h" | 17 #include "components/copresence/public/copresence_delegate.h" |
18 #include "extensions/browser/browser_context_keyed_api_factory.h" | 18 #include "extensions/browser/browser_context_keyed_api_factory.h" |
19 | 19 |
| 20 class ChromeWhispernetClient; |
| 21 |
20 namespace copresence { | 22 namespace copresence { |
21 class CopresenceManager; | 23 class CopresenceManager; |
22 class WhispernetClient; | 24 class WhispernetClient; |
23 } | 25 } |
24 | 26 |
25 namespace extensions { | 27 namespace extensions { |
26 | 28 |
27 class CopresenceService : public BrowserContextKeyedAPI, | 29 class CopresenceService : public BrowserContextKeyedAPI, |
28 public copresence::CopresenceDelegate { | 30 public copresence::CopresenceDelegate { |
29 public: | 31 public: |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 // BrowserContextKeyedAPI implementation. | 70 // BrowserContextKeyedAPI implementation. |
69 static const char* service_name() { return "CopresenceService"; } | 71 static const char* service_name() { return "CopresenceService"; } |
70 | 72 |
71 bool is_shutting_down_; | 73 bool is_shutting_down_; |
72 std::map<std::string, std::string> apps_by_subscription_id_; | 74 std::map<std::string, std::string> apps_by_subscription_id_; |
73 | 75 |
74 content::BrowserContext* const browser_context_; | 76 content::BrowserContext* const browser_context_; |
75 std::string api_key_; | 77 std::string api_key_; |
76 | 78 |
77 scoped_ptr<copresence::CopresenceManager> manager_; | 79 scoped_ptr<copresence::CopresenceManager> manager_; |
78 scoped_ptr<copresence::WhispernetClient> whispernet_client_; | 80 scoped_ptr<ChromeWhispernetClient> whispernet_client_; |
79 | 81 |
80 DISALLOW_COPY_AND_ASSIGN(CopresenceService); | 82 DISALLOW_COPY_AND_ASSIGN(CopresenceService); |
81 }; | 83 }; |
82 | 84 |
83 template <> | 85 template <> |
84 void BrowserContextKeyedAPIFactory< | 86 void BrowserContextKeyedAPIFactory< |
85 CopresenceService>::DeclareFactoryDependencies(); | 87 CopresenceService>::DeclareFactoryDependencies(); |
86 | 88 |
87 class CopresenceExecuteFunction : public ChromeUIThreadExtensionFunction { | 89 class CopresenceExecuteFunction : public ChromeUIThreadExtensionFunction { |
88 public: | 90 public: |
(...skipping 12 matching lines...) Expand all Loading... |
101 DECLARE_EXTENSION_FUNCTION("copresence.setApiKey", COPRESENCE_SETAPIKEY); | 103 DECLARE_EXTENSION_FUNCTION("copresence.setApiKey", COPRESENCE_SETAPIKEY); |
102 | 104 |
103 protected: | 105 protected: |
104 virtual ~CopresenceSetApiKeyFunction() {} | 106 virtual ~CopresenceSetApiKeyFunction() {} |
105 virtual ExtensionFunction::ResponseAction Run() override; | 107 virtual ExtensionFunction::ResponseAction Run() override; |
106 }; | 108 }; |
107 | 109 |
108 } // namespace extensions | 110 } // namespace extensions |
109 | 111 |
110 #endif // CHROME_BROWSER_EXTENSIONS_API_COPRESENCE_COPRESENCE_API_H_ | 112 #endif // CHROME_BROWSER_EXTENSIONS_API_COPRESENCE_COPRESENCE_API_H_ |
OLD | NEW |