| 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 SYNC_NOTIFIER_GCM_NETWORK_CHANNEL_DELEGATE_H_ | 5 #ifndef SYNC_NOTIFIER_GCM_NETWORK_CHANNEL_DELEGATE_H_ |
| 6 #define SYNC_NOTIFIER_GCM_NETWORK_CHANNEL_DELEGATE_H_ | 6 #define SYNC_NOTIFIER_GCM_NETWORK_CHANNEL_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // thread and callbacks should be invoked there as well. | 24 // thread and callbacks should be invoked there as well. |
| 25 class GCMNetworkChannelDelegate { | 25 class GCMNetworkChannelDelegate { |
| 26 public: | 26 public: |
| 27 typedef base::Callback<void(const GoogleServiceAuthError& error, | 27 typedef base::Callback<void(const GoogleServiceAuthError& error, |
| 28 const std::string& token)> RequestTokenCallback; | 28 const std::string& token)> RequestTokenCallback; |
| 29 typedef base::Callback<void(const std::string& registration_id, | 29 typedef base::Callback<void(const std::string& registration_id, |
| 30 gcm::GCMClient::Result result)> RegisterCallback; | 30 gcm::GCMClient::Result result)> RegisterCallback; |
| 31 | 31 |
| 32 virtual ~GCMNetworkChannelDelegate() {} | 32 virtual ~GCMNetworkChannelDelegate() {} |
| 33 | 33 |
| 34 virtual void Initialize() = 0; |
| 34 // Request access token. Callback should be called either with access token or | 35 // Request access token. Callback should be called either with access token or |
| 35 // error code. | 36 // error code. |
| 36 virtual void RequestToken(RequestTokenCallback callback) = 0; | 37 virtual void RequestToken(RequestTokenCallback callback) = 0; |
| 37 // Invalidate access token that was rejected by server. | 38 // Invalidate access token that was rejected by server. |
| 38 virtual void InvalidateToken(const std::string& token) = 0; | 39 virtual void InvalidateToken(const std::string& token) = 0; |
| 39 | 40 |
| 40 // Register with GCMProfileService. Callback should be called with either | 41 // Register with GCMProfileService. Callback should be called with either |
| 41 // registration id or error code. | 42 // registration id or error code. |
| 42 virtual void Register(RegisterCallback callback) = 0; | 43 virtual void Register(RegisterCallback callback) = 0; |
| 43 }; | 44 }; |
| 44 } // namespace syncer | 45 } // namespace syncer |
| 45 | 46 |
| 46 #endif // SYNC_NOTIFIER_GCM_NETWORK_CHANNEL_DELEGATE_H_ | 47 #endif // SYNC_NOTIFIER_GCM_NETWORK_CHANNEL_DELEGATE_H_ |
| OLD | NEW |