Chromium Code Reviews| Index: chrome/browser/extensions/api/copresence/copresence_api.h |
| diff --git a/chrome/browser/extensions/api/copresence/copresence_api.h b/chrome/browser/extensions/api/copresence/copresence_api.h |
| index 5776fd79d12654929cda55498774ca5d161d6f1b..ea74c26c939d27e01c2587238c2c8a0748e1b0b6 100644 |
| --- a/chrome/browser/extensions/api/copresence/copresence_api.h |
| +++ b/chrome/browser/extensions/api/copresence/copresence_api.h |
| @@ -43,7 +43,10 @@ class CopresenceService : public BrowserContextKeyedAPI, |
| return apps_by_subscription_id_; |
| } |
| - void set_api_key(const std::string& api_key) { api_key_ = api_key; } |
| + void set_api_key(const std::string& app_id, |
| + const std::string& api_key); |
| + void set_auth_token(const std::string& app_id, |
| + const std::string& token); |
| // Manager override for testing. |
| void set_manager_for_testing( |
| @@ -62,7 +65,9 @@ class CopresenceService : public BrowserContextKeyedAPI, |
| const std::vector<copresence::Message>& message) override; |
| virtual net::URLRequestContextGetter* GetRequestContext() const override; |
| virtual const std::string GetPlatformVersionString() const override; |
| - virtual const std::string GetAPIKey() const override; |
| + virtual const std::string GetAPIKey(const std::string& app_id) const override; |
| + virtual const std::string GetAuthToken(const std::string& app_id) const |
| + override; |
| virtual copresence::WhispernetClient* GetWhispernetClient() override; |
| // BrowserContextKeyedAPI implementation. |
| @@ -72,7 +77,8 @@ class CopresenceService : public BrowserContextKeyedAPI, |
| std::map<std::string, std::string> apps_by_subscription_id_; |
| content::BrowserContext* const browser_context_; |
| - std::string api_key_; |
| + std::map<std::string, std::string> api_keys_by_app_; |
|
rkc
2014/10/21 22:48:38
Instead of three different maps, all indexing by a
Charlie
2014/10/21 23:19:44
Putting the subscriptions IDs in doesn't actually
|
| + std::map<std::string, std::string> auth_tokens_by_app_; |
| scoped_ptr<copresence::CopresenceManager> manager_; |
| scoped_ptr<copresence::WhispernetClient> whispernet_client_; |
| @@ -105,6 +111,16 @@ class CopresenceSetApiKeyFunction : public ChromeUIThreadExtensionFunction { |
| virtual ExtensionFunction::ResponseAction Run() override; |
| }; |
| +class CopresenceSetAuthTokenFunction : public ChromeUIThreadExtensionFunction { |
| + public: |
| + DECLARE_EXTENSION_FUNCTION("copresence.setAuthToken", |
| + COPRESENCE_SETAUTHTOKEN); |
| + |
| + protected: |
| + virtual ~CopresenceSetAuthTokenFunction() {} |
| + virtual ExtensionFunction::ResponseAction Run() override; |
| +}; |
| + |
| } // namespace extensions |
| #endif // CHROME_BROWSER_EXTENSIONS_API_COPRESENCE_COPRESENCE_API_H_ |