| 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 25 matching lines...) Expand all Loading... |
| 36 // These accessors will always return an object. If the object doesn't exist, | 36 // These accessors will always return an object. If the object doesn't exist, |
| 37 // they will create one first. | 37 // they will create one first. |
| 38 copresence::CopresenceClient* client(); | 38 copresence::CopresenceClient* client(); |
| 39 copresence::WhispernetClient* whispernet_client(); | 39 copresence::WhispernetClient* whispernet_client(); |
| 40 | 40 |
| 41 // A registry containing the app id's associated with every subscription. | 41 // A registry containing the app id's associated with every subscription. |
| 42 SubscriptionToAppMap& apps_by_subscription_id() { | 42 SubscriptionToAppMap& apps_by_subscription_id() { |
| 43 return apps_by_subscription_id_; | 43 return apps_by_subscription_id_; |
| 44 } | 44 } |
| 45 | 45 |
| 46 // Client override for testing. |
| 47 void set_client_for_testing(scoped_ptr<copresence::CopresenceClient> client); |
| 48 |
| 46 // BrowserContextKeyedAPI implementation. | 49 // BrowserContextKeyedAPI implementation. |
| 47 static BrowserContextKeyedAPIFactory<CopresenceService>* GetFactoryInstance(); | 50 static BrowserContextKeyedAPIFactory<CopresenceService>* GetFactoryInstance(); |
| 48 | 51 |
| 49 private: | 52 private: |
| 50 friend class BrowserContextKeyedAPIFactory<CopresenceService>; | 53 friend class BrowserContextKeyedAPIFactory<CopresenceService>; |
| 51 | 54 |
| 52 // CopresenceClientDelegate overrides: | 55 // CopresenceClientDelegate overrides: |
| 53 virtual void HandleMessages( | 56 virtual void HandleMessages( |
| 54 const std::string& app_id, | 57 const std::string& app_id, |
| 55 const std::string& subscription_id, | 58 const std::string& subscription_id, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 DECLARE_EXTENSION_FUNCTION("copresence.setApiKey", COPRESENCE_SETAPIKEY); | 94 DECLARE_EXTENSION_FUNCTION("copresence.setApiKey", COPRESENCE_SETAPIKEY); |
| 92 | 95 |
| 93 protected: | 96 protected: |
| 94 virtual ~CopresenceSetApiKeyFunction() {} | 97 virtual ~CopresenceSetApiKeyFunction() {} |
| 95 virtual ExtensionFunction::ResponseAction Run() OVERRIDE; | 98 virtual ExtensionFunction::ResponseAction Run() OVERRIDE; |
| 96 }; | 99 }; |
| 97 | 100 |
| 98 } // namespace extensions | 101 } // namespace extensions |
| 99 | 102 |
| 100 #endif // CHROME_BROWSER_EXTENSIONS_API_COPRESENCE_COPRESENCE_API_H_ | 103 #endif // CHROME_BROWSER_EXTENSIONS_API_COPRESENCE_COPRESENCE_API_H_ |
| OLD | NEW |