| 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> |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 friend class BrowserContextKeyedAPIFactory<CopresenceService>; | 79 friend class BrowserContextKeyedAPIFactory<CopresenceService>; |
| 80 | 80 |
| 81 // CopresenceDelegate implementation | 81 // CopresenceDelegate implementation |
| 82 void HandleMessages(const std::string& app_id, | 82 void HandleMessages(const std::string& app_id, |
| 83 const std::string& subscription_id, | 83 const std::string& subscription_id, |
| 84 const std::vector<copresence::Message>& message) override; | 84 const std::vector<copresence::Message>& message) override; |
| 85 void HandleStatusUpdate(copresence::CopresenceStatus status) override; | 85 void HandleStatusUpdate(copresence::CopresenceStatus status) override; |
| 86 net::URLRequestContextGetter* GetRequestContext() const override; | 86 net::URLRequestContextGetter* GetRequestContext() const override; |
| 87 const std::string GetPlatformVersionString() const override; | 87 const std::string GetPlatformVersionString() const override; |
| 88 const std::string GetAPIKey(const std::string& app_id) const override; | 88 const std::string GetAPIKey(const std::string& app_id) const override; |
| 89 const std::string GetProjectId(const std::string& app_id) const override; | |
| 90 copresence::WhispernetClient* GetWhispernetClient() override; | 89 copresence::WhispernetClient* GetWhispernetClient() override; |
| 91 gcm::GCMDriver* GetGCMDriver() override; | 90 gcm::GCMDriver* GetGCMDriver() override; |
| 92 const std::string GetDeviceId(bool authenticated) override; | 91 const std::string GetDeviceId(bool authenticated) override; |
| 93 void SaveDeviceId(bool authenticated, const std::string& device_id) override; | 92 void SaveDeviceId(bool authenticated, const std::string& device_id) override; |
| 94 | 93 |
| 95 // BrowserContextKeyedAPI implementation. | 94 // BrowserContextKeyedAPI implementation. |
| 96 static const char* service_name() { return "CopresenceService"; } | 95 static const char* service_name() { return "CopresenceService"; } |
| 97 | 96 |
| 98 PrefService* GetPrefService(); | 97 PrefService* GetPrefService(); |
| 99 | 98 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 120 DECLARE_EXTENSION_FUNCTION("copresence.execute", COPRESENCE_EXECUTE); | 119 DECLARE_EXTENSION_FUNCTION("copresence.execute", COPRESENCE_EXECUTE); |
| 121 | 120 |
| 122 protected: | 121 protected: |
| 123 ~CopresenceExecuteFunction() override {} | 122 ~CopresenceExecuteFunction() override {} |
| 124 ExtensionFunction::ResponseAction Run() override; | 123 ExtensionFunction::ResponseAction Run() override; |
| 125 | 124 |
| 126 private: | 125 private: |
| 127 void SendResult(copresence::CopresenceStatus status); | 126 void SendResult(copresence::CopresenceStatus status); |
| 128 }; | 127 }; |
| 129 | 128 |
| 129 // TODO(ckehoe): Remove this function. |
| 130 class CopresenceSetApiKeyFunction : public ChromeUIThreadExtensionFunction { | 130 class CopresenceSetApiKeyFunction : public ChromeUIThreadExtensionFunction { |
| 131 public: | 131 public: |
| 132 DECLARE_EXTENSION_FUNCTION("copresence.setApiKey", COPRESENCE_SETAPIKEY); | 132 DECLARE_EXTENSION_FUNCTION("copresence.setApiKey", COPRESENCE_SETAPIKEY); |
| 133 | 133 |
| 134 protected: | 134 protected: |
| 135 ~CopresenceSetApiKeyFunction() override {} | 135 ~CopresenceSetApiKeyFunction() override {} |
| 136 ExtensionFunction::ResponseAction Run() override; | 136 ExtensionFunction::ResponseAction Run() override; |
| 137 }; | 137 }; |
| 138 | 138 |
| 139 class CopresenceSetAuthTokenFunction : public ChromeUIThreadExtensionFunction { | 139 class CopresenceSetAuthTokenFunction : public ChromeUIThreadExtensionFunction { |
| 140 public: | 140 public: |
| 141 DECLARE_EXTENSION_FUNCTION("copresence.setAuthToken", | 141 DECLARE_EXTENSION_FUNCTION("copresence.setAuthToken", |
| 142 COPRESENCE_SETAUTHTOKEN); | 142 COPRESENCE_SETAUTHTOKEN); |
| 143 | 143 |
| 144 protected: | 144 protected: |
| 145 ~CopresenceSetAuthTokenFunction() override {} | 145 ~CopresenceSetAuthTokenFunction() override {} |
| 146 ExtensionFunction::ResponseAction Run() override; | 146 ExtensionFunction::ResponseAction Run() override; |
| 147 }; | 147 }; |
| 148 | 148 |
| 149 } // namespace extensions | 149 } // namespace extensions |
| 150 | 150 |
| 151 #endif // CHROME_BROWSER_EXTENSIONS_API_COPRESENCE_COPRESENCE_API_H_ | 151 #endif // CHROME_BROWSER_EXTENSIONS_API_COPRESENCE_COPRESENCE_API_H_ |
| OLD | NEW |