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

Side by Side Diff: sync/notifier/gcm_network_channel_delegate.h

Issue 140513002: Client-to-server messages in GCMNetworkChannel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Two more tests Created 6 years, 11 months 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
(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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698