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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 // BrowserContextKeyedAPI implementation. | 69 // BrowserContextKeyedAPI implementation. |
68 static const char* service_name() { return "CopresenceService"; } | 70 static const char* service_name() { return "CopresenceService"; } |
69 | 71 |
70 bool is_shutting_down_; | 72 bool is_shutting_down_; |
71 std::map<std::string, std::string> apps_by_subscription_id_; | 73 std::map<std::string, std::string> apps_by_subscription_id_; |
72 | 74 |
73 content::BrowserContext* const browser_context_; | 75 content::BrowserContext* const browser_context_; |
74 std::string api_key_; | 76 std::string api_key_; |
75 | 77 |
76 scoped_ptr<copresence::CopresenceManager> manager_; | 78 scoped_ptr<copresence::CopresenceManager> manager_; |
77 scoped_ptr<copresence::WhispernetClient> whispernet_client_; | 79 scoped_ptr<ChromeWhispernetClient> whispernet_client_; |
78 | 80 |
79 DISALLOW_COPY_AND_ASSIGN(CopresenceService); | 81 DISALLOW_COPY_AND_ASSIGN(CopresenceService); |
80 }; | 82 }; |
81 | 83 |
82 template <> | 84 template <> |
83 void BrowserContextKeyedAPIFactory< | 85 void BrowserContextKeyedAPIFactory< |
84 CopresenceService>::DeclareFactoryDependencies(); | 86 CopresenceService>::DeclareFactoryDependencies(); |
85 | 87 |
86 class CopresenceExecuteFunction : public ChromeUIThreadExtensionFunction { | 88 class CopresenceExecuteFunction : public ChromeUIThreadExtensionFunction { |
87 public: | 89 public: |
(...skipping 12 matching lines...) Expand all Loading... |
100 DECLARE_EXTENSION_FUNCTION("copresence.setApiKey", COPRESENCE_SETAPIKEY); | 102 DECLARE_EXTENSION_FUNCTION("copresence.setApiKey", COPRESENCE_SETAPIKEY); |
101 | 103 |
102 protected: | 104 protected: |
103 ~CopresenceSetApiKeyFunction() override {} | 105 ~CopresenceSetApiKeyFunction() override {} |
104 ExtensionFunction::ResponseAction Run() override; | 106 ExtensionFunction::ResponseAction Run() override; |
105 }; | 107 }; |
106 | 108 |
107 } // namespace extensions | 109 } // namespace extensions |
108 | 110 |
109 #endif // CHROME_BROWSER_EXTENSIONS_API_COPRESENCE_COPRESENCE_API_H_ | 111 #endif // CHROME_BROWSER_EXTENSIONS_API_COPRESENCE_COPRESENCE_API_H_ |
OLD | NEW |