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

Side by Side Diff: google_apis/gcm/gcm_client.h

Issue 98173009: GCM Checkin implementation with unit tests and protobufs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gcm-store
Patch Set: Adding protobufs, request/response implementation and unit 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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 GOOGLE_APIS_GCM_GCM_CLIENT_H_ 5 #ifndef GOOGLE_APIS_GCM_GCM_CLIENT_H_
6 #define GOOGLE_APIS_GCM_GCM_CLIENT_H_ 6 #define GOOGLE_APIS_GCM_GCM_CLIENT_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "google_apis/gcm/base/gcm_export.h" 13 #include "google_apis/gcm/base/gcm_export.h"
14 #include "google_apis/gcm/protocol/checkin.pb.h"
14 15
15 namespace base { 16 namespace base {
16 class TaskRunner; 17 class TaskRunner;
17 } 18 }
18 19
19 namespace gcm { 20 namespace gcm {
20 21
21 // Interface that encapsulates the network communications with the Google Cloud 22 // Interface that encapsulates the network communications with the Google Cloud
22 // Messaging server. This interface is not supposed to be thread-safe. 23 // Messaging server. This interface is not supposed to be thread-safe.
23 class GCM_EXPORT GCMClient { 24 class GCM_EXPORT GCMClient {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 bool IsValid() const { return android_id != 0 && secret != 0; } 70 bool IsValid() const { return android_id != 0 && secret != 0; }
70 void Reset() { 71 void Reset() {
71 android_id = 0; 72 android_id = 0;
72 secret = 0; 73 secret = 0;
73 } 74 }
74 75
75 uint64 android_id; 76 uint64 android_id;
76 uint64 secret; 77 uint64 secret;
77 }; 78 };
78 79
80 // The check-in info of Chrome build.
81 struct GCM_EXPORT ChromeCheckInInfo {
jianli 2014/01/04 01:34:10 ChromeCheckInInfo can be easily confused with Chec
fgorski 2014/01/06 20:34:12 Done.
82 ChromeCheckInInfo()
83 : platform(checkin_proto::ChromeBuildProto::PLATFORM_WIN),
84 channel(checkin_proto::ChromeBuildProto::CHANNEL_UNKNOWN) {}
85
86 checkin_proto::ChromeBuildProto_Platform platform;
87 checkin_proto::ChromeBuildProto_Channel channel;
88 std::string chrome_version;
89 };
90
79 // A delegate interface that allows the GCMClient instance to interact with 91 // A delegate interface that allows the GCMClient instance to interact with
80 // its caller, i.e. notifying asynchronous event. 92 // its caller, i.e. notifying asynchronous event.
81 class Delegate { 93 class Delegate {
82 public: 94 public:
83 // Called when the user has been checked in successfully or an error occurs. 95 // Called when the user has been checked in successfully or an error occurs.
84 // |checkin_info|: valid if the checkin completed successfully. 96 // |checkin_info|: valid if the checkin completed successfully.
85 // |result|: the type of the error if an error occured, success otherwise. 97 // |result|: the type of the error if an error occured, success otherwise.
86 virtual void OnCheckInFinished(const CheckInInfo& checkin_info, 98 virtual void OnCheckInFinished(const CheckInInfo& checkin_info,
87 Result result) = 0; 99 Result result) = 0;
88 100
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 // Returns true if the loading from the persistent store is still in progress. 202 // Returns true if the loading from the persistent store is still in progress.
191 virtual bool IsLoading() const = 0; 203 virtual bool IsLoading() const = 0;
192 204
193 protected: 205 protected:
194 virtual ~GCMClient() {} 206 virtual ~GCMClient() {}
195 }; 207 };
196 208
197 } // namespace gcm 209 } // namespace gcm
198 210
199 #endif // GOOGLE_APIS_GCM_GCM_CLIENT_H_ 211 #endif // GOOGLE_APIS_GCM_GCM_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698