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

Side by Side Diff: google_apis/gcm/engine/gcm_store.h

Issue 215363007: [GCM] Adding basic G-services handling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressing the feedback Created 6 years, 9 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 | Annotate | Revision Log
OLDNEW
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 GOOGLE_APIS_GCM_ENGINE_GCM_STORE_H_ 5 #ifndef GOOGLE_APIS_GCM_ENGINE_GCM_STORE_H_
6 #define GOOGLE_APIS_GCM_ENGINE_GCM_STORE_H_ 6 #define GOOGLE_APIS_GCM_ENGINE_GCM_STORE_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 "base/callback_forward.h" 13 #include "base/callback_forward.h"
14 #include "base/memory/linked_ptr.h" 14 #include "base/memory/linked_ptr.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
17 #include "base/time/time.h"
17 #include "google_apis/gcm/base/gcm_export.h" 18 #include "google_apis/gcm/base/gcm_export.h"
18 #include "google_apis/gcm/engine/registration_info.h" 19 #include "google_apis/gcm/engine/registration_info.h"
19 #include "google_apis/gcm/protocol/mcs.pb.h" 20 #include "google_apis/gcm/protocol/mcs.pb.h"
20 21
21 namespace google { 22 namespace google {
22 namespace protobuf { 23 namespace protobuf {
23 class MessageLite; 24 class MessageLite;
24 } // namespace protobuf 25 } // namespace protobuf
25 } // namespace google 26 } // namespace google
26 27
(...skipping 13 matching lines...) Expand all
40 struct GCM_EXPORT LoadResult { 41 struct GCM_EXPORT LoadResult {
41 LoadResult(); 42 LoadResult();
42 ~LoadResult(); 43 ~LoadResult();
43 44
44 bool success; 45 bool success;
45 uint64 device_android_id; 46 uint64 device_android_id;
46 uint64 device_security_token; 47 uint64 device_security_token;
47 RegistrationInfoMap registrations; 48 RegistrationInfoMap registrations;
48 std::vector<std::string> incoming_messages; 49 std::vector<std::string> incoming_messages;
49 OutgoingMessageMap outgoing_messages; 50 OutgoingMessageMap outgoing_messages;
51 std::map<std::string, std::string> g_services_settings;
Nicolas Zea 2014/03/28 22:56:53 nit: the g_* prefix is typically used for globals
fgorski 2014/03/29 01:09:33 Done.
52 base::Time last_checkin_time;
50 }; 53 };
51 54
52 typedef std::vector<std::string> PersistentIdList; 55 typedef std::vector<std::string> PersistentIdList;
53 typedef base::Callback<void(scoped_ptr<LoadResult> result)> LoadCallback; 56 typedef base::Callback<void(scoped_ptr<LoadResult> result)> LoadCallback;
54 typedef base::Callback<void(bool success)> UpdateCallback; 57 typedef base::Callback<void(bool success)> UpdateCallback;
55 58
56 GCMStore(); 59 GCMStore();
57 virtual ~GCMStore(); 60 virtual ~GCMStore();
58 61
59 // Load the data from persistent store and pass the initial state back to 62 // Load the data from persistent store and pass the initial state back to
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 const MCSMessage& message, 97 const MCSMessage& message,
95 const UpdateCallback& callback) = 0; 98 const UpdateCallback& callback) = 0;
96 virtual void OverwriteOutgoingMessage(const std::string& persistent_id, 99 virtual void OverwriteOutgoingMessage(const std::string& persistent_id,
97 const MCSMessage& message, 100 const MCSMessage& message,
98 const UpdateCallback& callback) = 0; 101 const UpdateCallback& callback) = 0;
99 virtual void RemoveOutgoingMessage(const std::string& persistent_id, 102 virtual void RemoveOutgoingMessage(const std::string& persistent_id,
100 const UpdateCallback& callback) = 0; 103 const UpdateCallback& callback) = 0;
101 virtual void RemoveOutgoingMessages(const PersistentIdList& persistent_ids, 104 virtual void RemoveOutgoingMessages(const PersistentIdList& persistent_ids,
102 const UpdateCallback& callback) = 0; 105 const UpdateCallback& callback) = 0;
103 106
107 // GService Settings handling.
108 // |settings_to_remove| and |settings_to_add| don't need to be mutually
109 // exclusive. This will happen when the whole settings map is replaced.
110 virtual void UpdateGServicesSettings(
111 const std::vector<std::string>& settings_to_remove,
112 const std::map<std::string, std::string>& settings_to_add,
113 const base::Time& last_checkin_time,
114 const UpdateCallback& callback) = 0;
115
104 private: 116 private:
105 DISALLOW_COPY_AND_ASSIGN(GCMStore); 117 DISALLOW_COPY_AND_ASSIGN(GCMStore);
106 }; 118 };
107 119
108 } // namespace gcm 120 } // namespace gcm
109 121
110 #endif // GOOGLE_APIS_GCM_ENGINE_GCM_STORE_H_ 122 #endif // GOOGLE_APIS_GCM_ENGINE_GCM_STORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698