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; | 20 class ChromeWhispernetClient; |
21 | 21 |
22 namespace copresence { | 22 namespace copresence { |
23 class CopresenceManager; | 23 class CopresenceManager; |
24 class WhispernetClient; | 24 class WhispernetClient; |
25 } | 25 } |
26 | 26 |
| 27 namespace gcm { |
| 28 class GCMDriver; |
| 29 } |
| 30 |
27 namespace extensions { | 31 namespace extensions { |
28 | 32 |
29 class CopresenceService : public BrowserContextKeyedAPI, | 33 class CopresenceService : public BrowserContextKeyedAPI, |
30 public copresence::CopresenceDelegate { | 34 public copresence::CopresenceDelegate { |
31 public: | 35 public: |
32 explicit CopresenceService(content::BrowserContext* context); | 36 explicit CopresenceService(content::BrowserContext* context); |
33 ~CopresenceService() override; | 37 ~CopresenceService() override; |
34 | 38 |
35 // BrowserContextKeyedAPI implementation. | 39 // BrowserContextKeyedAPI implementation. |
36 void Shutdown() override; | 40 void Shutdown() override; |
(...skipping 29 matching lines...) Expand all Loading... |
66 | 70 |
67 // CopresenceDelegate implementation | 71 // CopresenceDelegate implementation |
68 void HandleMessages(const std::string& app_id, | 72 void HandleMessages(const std::string& app_id, |
69 const std::string& subscription_id, | 73 const std::string& subscription_id, |
70 const std::vector<copresence::Message>& message) override; | 74 const std::vector<copresence::Message>& message) override; |
71 void HandleStatusUpdate(copresence::CopresenceStatus status) override; | 75 void HandleStatusUpdate(copresence::CopresenceStatus status) override; |
72 net::URLRequestContextGetter* GetRequestContext() const override; | 76 net::URLRequestContextGetter* GetRequestContext() const override; |
73 const std::string GetPlatformVersionString() const override; | 77 const std::string GetPlatformVersionString() const override; |
74 const std::string GetAPIKey(const std::string& app_id) const override; | 78 const std::string GetAPIKey(const std::string& app_id) const override; |
75 copresence::WhispernetClient* GetWhispernetClient() override; | 79 copresence::WhispernetClient* GetWhispernetClient() override; |
| 80 gcm::GCMDriver* GetGCMDriver() override; |
76 | 81 |
77 // BrowserContextKeyedAPI implementation. | 82 // BrowserContextKeyedAPI implementation. |
78 static const char* service_name() { return "CopresenceService"; } | 83 static const char* service_name() { return "CopresenceService"; } |
79 | 84 |
80 bool is_shutting_down_; | 85 bool is_shutting_down_; |
81 std::map<std::string, std::string> apps_by_subscription_id_; | 86 std::map<std::string, std::string> apps_by_subscription_id_; |
82 | 87 |
83 content::BrowserContext* const browser_context_; | 88 content::BrowserContext* const browser_context_; |
84 std::map<std::string, std::string> api_keys_by_app_; | 89 std::map<std::string, std::string> api_keys_by_app_; |
85 | 90 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 COPRESENCE_SETAUTHTOKEN); | 129 COPRESENCE_SETAUTHTOKEN); |
125 | 130 |
126 protected: | 131 protected: |
127 virtual ~CopresenceSetAuthTokenFunction() {} | 132 virtual ~CopresenceSetAuthTokenFunction() {} |
128 ExtensionFunction::ResponseAction Run() override; | 133 ExtensionFunction::ResponseAction Run() override; |
129 }; | 134 }; |
130 | 135 |
131 } // namespace extensions | 136 } // namespace extensions |
132 | 137 |
133 #endif // CHROME_BROWSER_EXTENSIONS_API_COPRESENCE_COPRESENCE_API_H_ | 138 #endif // CHROME_BROWSER_EXTENSIONS_API_COPRESENCE_COPRESENCE_API_H_ |
OLD | NEW |