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