| 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 18 matching lines...) Expand all Loading... |
| 29 } | 29 } |
| 30 | 30 |
| 31 namespace net { | 31 namespace net { |
| 32 class URLRequestContextGetter; | 32 class URLRequestContextGetter; |
| 33 } | 33 } |
| 34 | 34 |
| 35 namespace gcm { | 35 namespace gcm { |
| 36 | 36 |
| 37 class GCMAppHandler; | 37 class GCMAppHandler; |
| 38 class GCMClientFactory; | 38 class GCMClientFactory; |
| 39 class GCMDelayedTaskController; |
| 39 | 40 |
| 40 // GCMDriver implementation for desktop and Chrome OS, using GCMClient. | 41 // GCMDriver implementation for desktop and Chrome OS, using GCMClient. |
| 41 class GCMDriverDesktop : public GCMDriver { | 42 class GCMDriverDesktop : public GCMDriver { |
| 42 public: | 43 public: |
| 43 GCMDriverDesktop( | 44 GCMDriverDesktop( |
| 44 scoped_ptr<GCMClientFactory> gcm_client_factory, | 45 scoped_ptr<GCMClientFactory> gcm_client_factory, |
| 45 const GCMClient::ChromeBuildInfo& chrome_build_info, | 46 const GCMClient::ChromeBuildInfo& chrome_build_info, |
| 46 const base::FilePath& store_path, | 47 const base::FilePath& store_path, |
| 47 const scoped_refptr<net::URLRequestContextGetter>& request_context, | 48 const scoped_refptr<net::URLRequestContextGetter>& request_context, |
| 48 const scoped_refptr<base::SequencedTaskRunner>& ui_thread, | 49 const scoped_refptr<base::SequencedTaskRunner>& ui_thread, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 virtual GCMClient::Result EnsureStarted() OVERRIDE; | 88 virtual GCMClient::Result EnsureStarted() OVERRIDE; |
| 88 virtual void RegisterImpl( | 89 virtual void RegisterImpl( |
| 89 const std::string& app_id, | 90 const std::string& app_id, |
| 90 const std::vector<std::string>& sender_ids) OVERRIDE; | 91 const std::vector<std::string>& sender_ids) OVERRIDE; |
| 91 virtual void UnregisterImpl(const std::string& app_id) OVERRIDE; | 92 virtual void UnregisterImpl(const std::string& app_id) OVERRIDE; |
| 92 virtual void SendImpl(const std::string& app_id, | 93 virtual void SendImpl(const std::string& app_id, |
| 93 const std::string& receiver_id, | 94 const std::string& receiver_id, |
| 94 const GCMClient::OutgoingMessage& message) OVERRIDE; | 95 const GCMClient::OutgoingMessage& message) OVERRIDE; |
| 95 | 96 |
| 96 private: | 97 private: |
| 97 class DelayedTaskController; | |
| 98 class IOWorker; | 98 class IOWorker; |
| 99 | 99 |
| 100 // Stops the GCM service. It can be restarted by calling EnsureStarted again. | 100 // Stops the GCM service. It can be restarted by calling EnsureStarted again. |
| 101 void Stop(); | 101 void Stop(); |
| 102 | 102 |
| 103 // Remove cached data when GCM service is stopped. | 103 // Remove cached data when GCM service is stopped. |
| 104 void RemoveCachedData(); | 104 void RemoveCachedData(); |
| 105 | 105 |
| 106 void DoRegister(const std::string& app_id, | 106 void DoRegister(const std::string& app_id, |
| 107 const std::vector<std::string>& sender_ids); | 107 const std::vector<std::string>& sender_ids); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 // it may be out of date while connection changes are happening. | 139 // it may be out of date while connection changes are happening. |
| 140 bool connected_; | 140 bool connected_; |
| 141 | 141 |
| 142 // List of observers to notify when connection state changes. | 142 // List of observers to notify when connection state changes. |
| 143 // Makes sure list is empty on destruction. | 143 // Makes sure list is empty on destruction. |
| 144 ObserverList<GCMConnectionObserver, true> connection_observer_list_; | 144 ObserverList<GCMConnectionObserver, true> connection_observer_list_; |
| 145 | 145 |
| 146 scoped_refptr<base::SequencedTaskRunner> ui_thread_; | 146 scoped_refptr<base::SequencedTaskRunner> ui_thread_; |
| 147 scoped_refptr<base::SequencedTaskRunner> io_thread_; | 147 scoped_refptr<base::SequencedTaskRunner> io_thread_; |
| 148 | 148 |
| 149 scoped_ptr<DelayedTaskController> delayed_task_controller_; | 149 scoped_ptr<GCMDelayedTaskController> delayed_task_controller_; |
| 150 | 150 |
| 151 // For all the work occurring on the IO thread. Must be destroyed on the IO | 151 // For all the work occurring on the IO thread. Must be destroyed on the IO |
| 152 // thread. | 152 // thread. |
| 153 scoped_ptr<IOWorker> io_worker_; | 153 scoped_ptr<IOWorker> io_worker_; |
| 154 | 154 |
| 155 // Callback for GetGCMStatistics. | 155 // Callback for GetGCMStatistics. |
| 156 GetGCMStatisticsCallback request_gcm_statistics_callback_; | 156 GetGCMStatisticsCallback request_gcm_statistics_callback_; |
| 157 | 157 |
| 158 // Used to pass a weak pointer to the IO worker. | 158 // Used to pass a weak pointer to the IO worker. |
| 159 base::WeakPtrFactory<GCMDriverDesktop> weak_ptr_factory_; | 159 base::WeakPtrFactory<GCMDriverDesktop> weak_ptr_factory_; |
| 160 | 160 |
| 161 DISALLOW_COPY_AND_ASSIGN(GCMDriverDesktop); | 161 DISALLOW_COPY_AND_ASSIGN(GCMDriverDesktop); |
| 162 }; | 162 }; |
| 163 | 163 |
| 164 } // namespace gcm | 164 } // namespace gcm |
| 165 | 165 |
| 166 #endif // COMPONENTS_GCM_DRIVER_GCM_DRIVER_DESKTOP_H_ | 166 #endif // COMPONENTS_GCM_DRIVER_GCM_DRIVER_DESKTOP_H_ |
| OLD | NEW |