Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(503)

Side by Side Diff: components/gcm_driver/gcm_driver_desktop.h

Issue 681453004: [GCM] Adding last token fetching time handling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 bool IsStarted() const override; 74 bool IsStarted() const override;
75 bool IsConnected() const override; 75 bool IsConnected() const override;
76 void GetGCMStatistics(const GetGCMStatisticsCallback& callback, 76 void GetGCMStatistics(const GetGCMStatisticsCallback& callback,
77 bool clear_logs) override; 77 bool clear_logs) override;
78 void SetGCMRecording(const GetGCMStatisticsCallback& callback, 78 void SetGCMRecording(const GetGCMStatisticsCallback& callback,
79 bool recording) override; 79 bool recording) override;
80 void SetAccountTokens( 80 void SetAccountTokens(
81 const std::vector<GCMClient::AccountTokenInfo>& account_tokens) override; 81 const std::vector<GCMClient::AccountTokenInfo>& account_tokens) override;
82 void UpdateAccountMapping(const AccountMapping& account_mapping) override; 82 void UpdateAccountMapping(const AccountMapping& account_mapping) override;
83 void RemoveAccountMapping(const std::string& account_id) override; 83 void RemoveAccountMapping(const std::string& account_id) override;
84 base::Time GetLastTokenFetchingTime() override;
85 void SetLastTokenFetchingTime(const base::Time& time) override;
84 86
85 // Exposed for testing purpose. 87 // Exposed for testing purpose.
86 bool gcm_enabled() const { return gcm_enabled_; } 88 bool gcm_enabled() const { return gcm_enabled_; }
87 GCMChannelStatusSyncer* gcm_channel_status_syncer_for_testing() { 89 GCMChannelStatusSyncer* gcm_channel_status_syncer_for_testing() {
88 return gcm_channel_status_syncer_.get(); 90 return gcm_channel_status_syncer_.get();
89 } 91 }
90 92
91 protected: 93 protected:
92 // GCMDriver implementation: 94 // GCMDriver implementation:
93 GCMClient::Result EnsureStarted() override; 95 GCMClient::Result EnsureStarted() override;
(...skipping 22 matching lines...) Expand all
116 118
117 // Callbacks posted from IO thread to UI thread. 119 // Callbacks posted from IO thread to UI thread.
118 void MessageReceived(const std::string& app_id, 120 void MessageReceived(const std::string& app_id,
119 const GCMClient::IncomingMessage& message); 121 const GCMClient::IncomingMessage& message);
120 void MessagesDeleted(const std::string& app_id); 122 void MessagesDeleted(const std::string& app_id);
121 void MessageSendError(const std::string& app_id, 123 void MessageSendError(const std::string& app_id,
122 const GCMClient::SendErrorDetails& send_error_details); 124 const GCMClient::SendErrorDetails& send_error_details);
123 void SendAcknowledged(const std::string& app_id, 125 void SendAcknowledged(const std::string& app_id,
124 const std::string& message_id); 126 const std::string& message_id);
125 void GCMClientReady( 127 void GCMClientReady(
126 const std::vector<AccountMapping>& account_mappings); 128 const std::vector<AccountMapping>& account_mappings,
129 const base::Time& last_token_fetching_time);
127 void OnConnected(const net::IPEndPoint& ip_endpoint); 130 void OnConnected(const net::IPEndPoint& ip_endpoint);
128 void OnDisconnected(); 131 void OnDisconnected();
129 132
130 void GetGCMStatisticsFinished(const GCMClient::GCMStatistics& stats); 133 void GetGCMStatisticsFinished(const GCMClient::GCMStatistics& stats);
131 134
132 scoped_ptr<GCMChannelStatusSyncer> gcm_channel_status_syncer_; 135 scoped_ptr<GCMChannelStatusSyncer> gcm_channel_status_syncer_;
133 136
134 // Flag to indicate whether the user is signed in to a GAIA account. 137 // Flag to indicate whether the user is signed in to a GAIA account.
135 // TODO(jianli): To be removed when sign-in enforcement is dropped. 138 // TODO(jianli): To be removed when sign-in enforcement is dropped.
136 bool signed_in_; 139 bool signed_in_;
(...skipping 10 matching lines...) Expand all
147 // it may be out of date while connection changes are happening. 150 // it may be out of date while connection changes are happening.
148 bool connected_; 151 bool connected_;
149 152
150 // List of observers to notify when connection state changes. 153 // List of observers to notify when connection state changes.
151 // Makes sure list is empty on destruction. 154 // Makes sure list is empty on destruction.
152 ObserverList<GCMConnectionObserver, true> connection_observer_list_; 155 ObserverList<GCMConnectionObserver, true> connection_observer_list_;
153 156
154 // Account mapper. Only works when user is signed in. 157 // Account mapper. Only works when user is signed in.
155 scoped_ptr<GCMAccountMapper> account_mapper_; 158 scoped_ptr<GCMAccountMapper> account_mapper_;
156 159
160 // Time of last token fetching.
161 base::Time last_token_fetching_time_;
162
157 scoped_refptr<base::SequencedTaskRunner> ui_thread_; 163 scoped_refptr<base::SequencedTaskRunner> ui_thread_;
158 scoped_refptr<base::SequencedTaskRunner> io_thread_; 164 scoped_refptr<base::SequencedTaskRunner> io_thread_;
159 165
160 scoped_ptr<GCMDelayedTaskController> delayed_task_controller_; 166 scoped_ptr<GCMDelayedTaskController> delayed_task_controller_;
161 167
162 // For all the work occurring on the IO thread. Must be destroyed on the IO 168 // For all the work occurring on the IO thread. Must be destroyed on the IO
163 // thread. 169 // thread.
164 scoped_ptr<IOWorker> io_worker_; 170 scoped_ptr<IOWorker> io_worker_;
165 171
166 // Callback for GetGCMStatistics. 172 // Callback for GetGCMStatistics.
167 GetGCMStatisticsCallback request_gcm_statistics_callback_; 173 GetGCMStatisticsCallback request_gcm_statistics_callback_;
168 174
169 // Used to pass a weak pointer to the IO worker. 175 // Used to pass a weak pointer to the IO worker.
170 base::WeakPtrFactory<GCMDriverDesktop> weak_ptr_factory_; 176 base::WeakPtrFactory<GCMDriverDesktop> weak_ptr_factory_;
171 177
172 DISALLOW_COPY_AND_ASSIGN(GCMDriverDesktop); 178 DISALLOW_COPY_AND_ASSIGN(GCMDriverDesktop);
173 }; 179 };
174 180
175 } // namespace gcm 181 } // namespace gcm
176 182
177 #endif // COMPONENTS_GCM_DRIVER_GCM_DRIVER_DESKTOP_H_ 183 #endif // COMPONENTS_GCM_DRIVER_GCM_DRIVER_DESKTOP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698