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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 virtual void Purge() OVERRIDE; | 54 virtual void Purge() OVERRIDE; |
55 virtual void AddAppHandler(const std::string& app_id, | 55 virtual void AddAppHandler(const std::string& app_id, |
56 GCMAppHandler* handler) OVERRIDE; | 56 GCMAppHandler* handler) OVERRIDE; |
57 virtual void RemoveAppHandler(const std::string& app_id) OVERRIDE; | 57 virtual void RemoveAppHandler(const std::string& app_id) OVERRIDE; |
58 | 58 |
59 // GCMDriver implementation: | 59 // GCMDriver implementation: |
60 virtual void Enable() OVERRIDE; | 60 virtual void Enable() OVERRIDE; |
61 virtual void Disable() OVERRIDE; | 61 virtual void Disable() OVERRIDE; |
62 virtual GCMClient* GetGCMClientForTesting() const OVERRIDE; | 62 virtual GCMClient* GetGCMClientForTesting() const OVERRIDE; |
63 virtual bool IsStarted() const OVERRIDE; | 63 virtual bool IsStarted() const OVERRIDE; |
64 virtual bool IsGCMClientReady() const OVERRIDE; | |
65 virtual bool IsConnected() const OVERRIDE; | 64 virtual bool IsConnected() const OVERRIDE; |
66 virtual void GetGCMStatistics(const GetGCMStatisticsCallback& callback, | 65 virtual void GetGCMStatistics(const GetGCMStatisticsCallback& callback, |
67 bool clear_logs) OVERRIDE; | 66 bool clear_logs) OVERRIDE; |
68 virtual void SetGCMRecording(const GetGCMStatisticsCallback& callback, | 67 virtual void SetGCMRecording(const GetGCMStatisticsCallback& callback, |
69 bool recording) OVERRIDE; | 68 bool recording) OVERRIDE; |
70 | 69 |
71 protected: | 70 protected: |
72 // GCMDriver implementation: | 71 // GCMDriver implementation: |
73 virtual GCMClient::Result EnsureStarted() OVERRIDE; | 72 virtual GCMClient::Result EnsureStarted() OVERRIDE; |
74 virtual void RegisterImpl( | 73 virtual void RegisterImpl( |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 // Flag to indicate whether the user is signed in to a GAIA account. | 110 // Flag to indicate whether the user is signed in to a GAIA account. |
112 // TODO(jianli): To be removed when sign-in enforcement is dropped. | 111 // TODO(jianli): To be removed when sign-in enforcement is dropped. |
113 bool signed_in_; | 112 bool signed_in_; |
114 | 113 |
115 // Flag to indicate if GCM is started. | 114 // Flag to indicate if GCM is started. |
116 bool gcm_started_; | 115 bool gcm_started_; |
117 | 116 |
118 // Flag to indicate if GCM is enabled. | 117 // Flag to indicate if GCM is enabled. |
119 bool gcm_enabled_; | 118 bool gcm_enabled_; |
120 | 119 |
121 // Flag to indicate if GCMClient is ready. | |
122 bool gcm_client_ready_; | |
123 | |
124 // Flag to indicate the last known state of the GCM client. Because this | 120 // Flag to indicate the last known state of the GCM client. Because this |
125 // flag lives on the UI thread, while the GCM client lives on the IO thread, | 121 // flag lives on the UI thread, while the GCM client lives on the IO thread, |
126 // it may be out of date while connection changes are happening. | 122 // it may be out of date while connection changes are happening. |
127 bool connected_; | 123 bool connected_; |
128 | 124 |
129 scoped_refptr<base::SequencedTaskRunner> ui_thread_; | 125 scoped_refptr<base::SequencedTaskRunner> ui_thread_; |
130 scoped_refptr<base::SequencedTaskRunner> io_thread_; | 126 scoped_refptr<base::SequencedTaskRunner> io_thread_; |
131 | 127 |
132 scoped_ptr<DelayedTaskController> delayed_task_controller_; | 128 scoped_ptr<DelayedTaskController> delayed_task_controller_; |
133 | 129 |
134 // For all the work occurring on the IO thread. Must be destroyed on the IO | 130 // For all the work occurring on the IO thread. Must be destroyed on the IO |
135 // thread. | 131 // thread. |
136 scoped_ptr<IOWorker> io_worker_; | 132 scoped_ptr<IOWorker> io_worker_; |
137 | 133 |
138 // Callback for GetGCMStatistics. | 134 // Callback for GetGCMStatistics. |
139 GetGCMStatisticsCallback request_gcm_statistics_callback_; | 135 GetGCMStatisticsCallback request_gcm_statistics_callback_; |
140 | 136 |
141 // Used to pass a weak pointer to the IO worker. | 137 // Used to pass a weak pointer to the IO worker. |
142 base::WeakPtrFactory<GCMDriverDesktop> weak_ptr_factory_; | 138 base::WeakPtrFactory<GCMDriverDesktop> weak_ptr_factory_; |
143 | 139 |
144 DISALLOW_COPY_AND_ASSIGN(GCMDriverDesktop); | 140 DISALLOW_COPY_AND_ASSIGN(GCMDriverDesktop); |
145 }; | 141 }; |
146 | 142 |
147 } // namespace gcm | 143 } // namespace gcm |
148 | 144 |
149 #endif // COMPONENTS_GCM_DRIVER_GCM_DRIVER_DESKTOP_H_ | 145 #endif // COMPONENTS_GCM_DRIVER_GCM_DRIVER_DESKTOP_H_ |
OLD | NEW |