OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef SYNC_NOTIFIER_GCM_NETWORK_CHANNEL_DELEGATE_H_ | |
6 #define SYNC_NOTIFIER_GCM_NETWORK_CHANNEL_DELEGATE_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/callback.h" | |
11 #include "google_apis/gcm/gcm_client.h" | |
12 | |
13 class GoogleServiceAuthError; | |
14 | |
15 namespace syncer { | |
16 | |
17 // Delegate for GCMNetworkChannel. | |
18 // GCMNetworkChannel needs Register to register with GCM client and obtain gcm | |
19 // registration id. This id is used for building URL to Tango endpoint. | |
tim (not reviewing)
2014/01/17 19:33:42
nit- "cache invalidation", not "Tango".
pavely
2014/01/17 22:52:26
Done.
| |
20 // It needs RequestToken and InvalidateToken to get access token to include it | |
21 // in HTTP message to server. | |
22 // GCMNetworkChannel lives on IO thread therefore calls will be made on IO | |
23 // thread and callbacks should be invoked there as well. | |
24 class GCMNetworkChannelDelegate { | |
25 public: | |
26 typedef base::Callback<void(const GoogleServiceAuthError& error, | |
27 const std::string& token)> RequestTokenCallback; | |
28 typedef base::Callback<void(const std::string& registration_id, | |
29 gcm::GCMClient::Result result)> RegisterCallback; | |
30 | |
31 virtual ~GCMNetworkChannelDelegate() {} | |
32 | |
33 // Request access token. Callback should be called either with access token or | |
34 // error code. | |
35 virtual void RequestToken(RequestTokenCallback callback) = 0; | |
36 // Invalidate access token that was rejected by server. | |
37 virtual void InvalidateToken(const std::string& token) = 0; | |
38 | |
39 // Register with GCMProfileService. Callback should be called with either | |
40 // registration id or error code. | |
41 virtual void Register(RegisterCallback callback) = 0; | |
42 }; | |
43 } // namespace syncer | |
44 | |
45 #endif // SYNC_NOTIFIER_GCM_NETWORK_CHANNEL_DELEGATE_H_ | |
OLD | NEW |