| 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 COMPONENTS_GCM_DRIVER_GCM_DRIVER_DESKTOP_H_ | 5 #ifndef COMPONENTS_GCM_DRIVER_GCM_DRIVER_DESKTOP_H_ |
| 6 #define COMPONENTS_GCM_DRIVER_GCM_DRIVER_DESKTOP_H_ | 6 #define COMPONENTS_GCM_DRIVER_GCM_DRIVER_DESKTOP_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 scoped_ptr<GCMClientFactory> gcm_client_factory, | 49 scoped_ptr<GCMClientFactory> gcm_client_factory, |
| 50 const GCMClient::ChromeBuildInfo& chrome_build_info, | 50 const GCMClient::ChromeBuildInfo& chrome_build_info, |
| 51 const std::string& channel_status_request_url, | 51 const std::string& channel_status_request_url, |
| 52 const std::string& user_agent, | 52 const std::string& user_agent, |
| 53 PrefService* prefs, | 53 PrefService* prefs, |
| 54 const base::FilePath& store_path, | 54 const base::FilePath& store_path, |
| 55 const scoped_refptr<net::URLRequestContextGetter>& request_context, | 55 const scoped_refptr<net::URLRequestContextGetter>& request_context, |
| 56 const scoped_refptr<base::SequencedTaskRunner>& ui_thread, | 56 const scoped_refptr<base::SequencedTaskRunner>& ui_thread, |
| 57 const scoped_refptr<base::SequencedTaskRunner>& io_thread, | 57 const scoped_refptr<base::SequencedTaskRunner>& io_thread, |
| 58 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner); | 58 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner); |
| 59 virtual ~GCMDriverDesktop(); | 59 ~GCMDriverDesktop() override; |
| 60 | 60 |
| 61 // GCMDriver overrides: | 61 // GCMDriver overrides: |
| 62 virtual void Shutdown() override; | 62 void Shutdown() override; |
| 63 virtual void OnSignedIn() override; | 63 void OnSignedIn() override; |
| 64 virtual void OnSignedOut() override; | 64 void OnSignedOut() override; |
| 65 virtual void Purge() override; | 65 void Purge() override; |
| 66 virtual void AddAppHandler(const std::string& app_id, | 66 void AddAppHandler(const std::string& app_id, |
| 67 GCMAppHandler* handler) override; | 67 GCMAppHandler* handler) override; |
| 68 virtual void RemoveAppHandler(const std::string& app_id) override; | 68 void RemoveAppHandler(const std::string& app_id) override; |
| 69 virtual void AddConnectionObserver(GCMConnectionObserver* observer) override; | 69 void AddConnectionObserver(GCMConnectionObserver* observer) override; |
| 70 virtual void RemoveConnectionObserver( | 70 void RemoveConnectionObserver(GCMConnectionObserver* observer) override; |
| 71 GCMConnectionObserver* observer) override; | 71 void Enable() override; |
| 72 virtual void Enable() override; | 72 void Disable() override; |
| 73 virtual void Disable() override; | 73 GCMClient* GetGCMClientForTesting() const override; |
| 74 virtual GCMClient* GetGCMClientForTesting() const override; | 74 bool IsStarted() const override; |
| 75 virtual bool IsStarted() const override; | 75 bool IsConnected() const override; |
| 76 virtual bool IsConnected() const override; | 76 void GetGCMStatistics(const GetGCMStatisticsCallback& callback, |
| 77 virtual void GetGCMStatistics(const GetGCMStatisticsCallback& callback, | 77 bool clear_logs) override; |
| 78 bool clear_logs) override; | 78 void SetGCMRecording(const GetGCMStatisticsCallback& callback, |
| 79 virtual void SetGCMRecording(const GetGCMStatisticsCallback& callback, | 79 bool recording) override; |
| 80 bool recording) override; | 80 void SetAccountTokens( |
| 81 virtual void SetAccountTokens( | |
| 82 const std::vector<GCMClient::AccountTokenInfo>& account_tokens) override; | 81 const std::vector<GCMClient::AccountTokenInfo>& account_tokens) override; |
| 83 virtual void UpdateAccountMapping( | 82 void UpdateAccountMapping(const AccountMapping& account_mapping) override; |
| 84 const AccountMapping& account_mapping) override; | 83 void RemoveAccountMapping(const std::string& account_id) override; |
| 85 virtual void RemoveAccountMapping(const std::string& account_id) override; | |
| 86 | 84 |
| 87 // Exposed for testing purpose. | 85 // Exposed for testing purpose. |
| 88 bool gcm_enabled() const { return gcm_enabled_; } | 86 bool gcm_enabled() const { return gcm_enabled_; } |
| 89 GCMChannelStatusSyncer* gcm_channel_status_syncer_for_testing() { | 87 GCMChannelStatusSyncer* gcm_channel_status_syncer_for_testing() { |
| 90 return gcm_channel_status_syncer_.get(); | 88 return gcm_channel_status_syncer_.get(); |
| 91 } | 89 } |
| 92 | 90 |
| 93 protected: | 91 protected: |
| 94 // GCMDriver implementation: | 92 // GCMDriver implementation: |
| 95 virtual GCMClient::Result EnsureStarted() override; | 93 GCMClient::Result EnsureStarted() override; |
| 96 virtual void RegisterImpl( | 94 void RegisterImpl(const std::string& app_id, |
| 97 const std::string& app_id, | 95 const std::vector<std::string>& sender_ids) override; |
| 98 const std::vector<std::string>& sender_ids) override; | 96 void UnregisterImpl(const std::string& app_id) override; |
| 99 virtual void UnregisterImpl(const std::string& app_id) override; | 97 void SendImpl(const std::string& app_id, |
| 100 virtual void SendImpl(const std::string& app_id, | 98 const std::string& receiver_id, |
| 101 const std::string& receiver_id, | 99 const GCMClient::OutgoingMessage& message) override; |
| 102 const GCMClient::OutgoingMessage& message) override; | |
| 103 | 100 |
| 104 private: | 101 private: |
| 105 class IOWorker; | 102 class IOWorker; |
| 106 | 103 |
| 107 // Stops the GCM service. It can be restarted by calling EnsureStarted again. | 104 // Stops the GCM service. It can be restarted by calling EnsureStarted again. |
| 108 void Stop(); | 105 void Stop(); |
| 109 | 106 |
| 110 // Remove cached data when GCM service is stopped. | 107 // Remove cached data when GCM service is stopped. |
| 111 void RemoveCachedData(); | 108 void RemoveCachedData(); |
| 112 | 109 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 | 168 |
| 172 // Used to pass a weak pointer to the IO worker. | 169 // Used to pass a weak pointer to the IO worker. |
| 173 base::WeakPtrFactory<GCMDriverDesktop> weak_ptr_factory_; | 170 base::WeakPtrFactory<GCMDriverDesktop> weak_ptr_factory_; |
| 174 | 171 |
| 175 DISALLOW_COPY_AND_ASSIGN(GCMDriverDesktop); | 172 DISALLOW_COPY_AND_ASSIGN(GCMDriverDesktop); |
| 176 }; | 173 }; |
| 177 | 174 |
| 178 } // namespace gcm | 175 } // namespace gcm |
| 179 | 176 |
| 180 #endif // COMPONENTS_GCM_DRIVER_GCM_DRIVER_DESKTOP_H_ | 177 #endif // COMPONENTS_GCM_DRIVER_GCM_DRIVER_DESKTOP_H_ |
| OLD | NEW |