| 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_H_ | 5 #ifndef COMPONENTS_GCM_DRIVER_GCM_DRIVER_H_ |
| 6 #define COMPONENTS_GCM_DRIVER_GCM_DRIVER_H_ | 6 #define COMPONENTS_GCM_DRIVER_GCM_DRIVER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 typedef base::Callback<void(const std::string& registration_id, | 78 typedef base::Callback<void(const std::string& registration_id, |
| 79 GCMClient::Result result)> RegisterCallback; | 79 GCMClient::Result result)> RegisterCallback; |
| 80 typedef base::Callback<void(const std::string& message_id, | 80 typedef base::Callback<void(const std::string& message_id, |
| 81 GCMClient::Result result)> SendCallback; | 81 GCMClient::Result result)> SendCallback; |
| 82 typedef base::Callback<void(const std::string&, const std::string&)> | 82 typedef base::Callback<void(const std::string&, const std::string&)> |
| 83 GetPublicKeyCallback; | 83 GetPublicKeyCallback; |
| 84 typedef base::Callback<void(GCMClient::Result result)> UnregisterCallback; | 84 typedef base::Callback<void(GCMClient::Result result)> UnregisterCallback; |
| 85 typedef base::Callback<void(const GCMClient::GCMStatistics& stats)> | 85 typedef base::Callback<void(const GCMClient::GCMStatistics& stats)> |
| 86 GetGCMStatisticsCallback; | 86 GetGCMStatisticsCallback; |
| 87 | 87 |
| 88 // Enumeration to be used with GetGCMStatistics() for indicating whether the |
| 89 // existing logs should be cleared or kept. |
| 90 enum ClearActivityLogs { |
| 91 CLEAR_LOGS, |
| 92 KEEP_LOGS |
| 93 }; |
| 94 |
| 88 GCMDriver( | 95 GCMDriver( |
| 89 const base::FilePath& store_path, | 96 const base::FilePath& store_path, |
| 90 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner); | 97 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner); |
| 91 virtual ~GCMDriver(); | 98 virtual ~GCMDriver(); |
| 92 | 99 |
| 93 // Registers |sender_ids| for an app. A registration ID will be returned by | 100 // Registers |sender_ids| for an app. A registration ID will be returned by |
| 94 // the GCM server. On Android, only a single sender ID is supported, but | 101 // the GCM server. On Android, only a single sender ID is supported, but |
| 95 // instead multiple simultaneous registrations are allowed. | 102 // instead multiple simultaneous registrations are allowed. |
| 96 // |app_id|: application ID. | 103 // |app_id|: application ID. |
| 97 // |sender_ids|: list of IDs of the servers that are allowed to send the | 104 // |sender_ids|: list of IDs of the servers that are allowed to send the |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 | 173 |
| 167 // For testing purpose. Always NULL on Android. | 174 // For testing purpose. Always NULL on Android. |
| 168 virtual GCMClient* GetGCMClientForTesting() const = 0; | 175 virtual GCMClient* GetGCMClientForTesting() const = 0; |
| 169 | 176 |
| 170 // Returns true if the service was started. | 177 // Returns true if the service was started. |
| 171 virtual bool IsStarted() const = 0; | 178 virtual bool IsStarted() const = 0; |
| 172 | 179 |
| 173 // Returns true if the gcm client has an open and active connection. | 180 // Returns true if the gcm client has an open and active connection. |
| 174 virtual bool IsConnected() const = 0; | 181 virtual bool IsConnected() const = 0; |
| 175 | 182 |
| 176 // Get GCM client internal states and statistics. | 183 // Get GCM client internal states and statistics. The activity logs will be |
| 177 // If clear_logs is true then activity logs will be cleared before the stats | 184 // cleared before returning the stats when |clear_logs| is set to CLEAR_LOGS. |
| 178 // are returned. | |
| 179 virtual void GetGCMStatistics(const GetGCMStatisticsCallback& callback, | 185 virtual void GetGCMStatistics(const GetGCMStatisticsCallback& callback, |
| 180 bool clear_logs) = 0; | 186 ClearActivityLogs clear_logs) = 0; |
| 181 | 187 |
| 182 // Enables/disables GCM activity recording, and then returns the stats. | 188 // Enables/disables GCM activity recording, and then returns the stats. |
| 183 virtual void SetGCMRecording(const GetGCMStatisticsCallback& callback, | 189 virtual void SetGCMRecording(const GetGCMStatisticsCallback& callback, |
| 184 bool recording) = 0; | 190 bool recording) = 0; |
| 185 | 191 |
| 186 // sets a list of signed in accounts with OAuth2 access tokens, when GCMDriver | 192 // sets a list of signed in accounts with OAuth2 access tokens, when GCMDriver |
| 187 // works in context of a signed in entity (e.g. browser profile where user is | 193 // works in context of a signed in entity (e.g. browser profile where user is |
| 188 // signed into sync). | 194 // signed into sync). |
| 189 // |account_tokens|: list of email addresses, account IDs and OAuth2 access | 195 // |account_tokens|: list of email addresses, account IDs and OAuth2 access |
| 190 // tokens. | 196 // tokens. |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 DefaultGCMAppHandler default_app_handler_; | 317 DefaultGCMAppHandler default_app_handler_; |
| 312 | 318 |
| 313 base::WeakPtrFactory<GCMDriver> weak_ptr_factory_; | 319 base::WeakPtrFactory<GCMDriver> weak_ptr_factory_; |
| 314 | 320 |
| 315 DISALLOW_COPY_AND_ASSIGN(GCMDriver); | 321 DISALLOW_COPY_AND_ASSIGN(GCMDriver); |
| 316 }; | 322 }; |
| 317 | 323 |
| 318 } // namespace gcm | 324 } // namespace gcm |
| 319 | 325 |
| 320 #endif // COMPONENTS_GCM_DRIVER_GCM_DRIVER_H_ | 326 #endif // COMPONENTS_GCM_DRIVER_GCM_DRIVER_H_ |
| OLD | NEW |