OLD | NEW |
---|---|
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_IMPL_H_ | 5 #ifndef GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_ |
6 #define GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_ | 6 #define GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
66 const net::BackoffEntry::Policy& backoff_policy, | 66 const net::BackoffEntry::Policy& backoff_policy, |
67 scoped_refptr<net::HttpNetworkSession> network_session, | 67 scoped_refptr<net::HttpNetworkSession> network_session, |
68 net::NetLog* net_log, | 68 net::NetLog* net_log, |
69 GCMStatsRecorder* recorder); | 69 GCMStatsRecorder* recorder); |
70 }; | 70 }; |
71 | 71 |
72 // Implements the GCM Client. It is used to coordinate MCS Client (communication | 72 // Implements the GCM Client. It is used to coordinate MCS Client (communication |
73 // with MCS) and other pieces of GCM infrastructure like Registration and | 73 // with MCS) and other pieces of GCM infrastructure like Registration and |
74 // Checkins. It also allows for registering user delegates that host | 74 // Checkins. It also allows for registering user delegates that host |
75 // applications that send and receive messages. | 75 // applications that send and receive messages. |
76 class GCM_EXPORT GCMClientImpl : public GCMClient { | 76 class GCM_EXPORT GCMClientImpl |
77 : public GCMClient, GCMStatsRecorder::RecorderDelegate { | |
jianli
2014/05/06 22:54:53
nit: add public
juyik
2014/05/07 00:07:48
Done.
| |
77 public: | 78 public: |
78 explicit GCMClientImpl(scoped_ptr<GCMInternalsBuilder> internals_builder); | 79 explicit GCMClientImpl(scoped_ptr<GCMInternalsBuilder> internals_builder); |
79 virtual ~GCMClientImpl(); | 80 virtual ~GCMClientImpl(); |
80 | 81 |
81 // Overridden from GCMClient: | 82 // Overridden from GCMClient: |
82 virtual void Initialize( | 83 virtual void Initialize( |
83 const checkin_proto::ChromeBuildProto& chrome_build_proto, | 84 const checkin_proto::ChromeBuildProto& chrome_build_proto, |
84 const base::FilePath& store_path, | 85 const base::FilePath& store_path, |
85 const std::vector<std::string>& account_ids, | 86 const std::vector<std::string>& account_ids, |
86 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner, | 87 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner, |
87 const scoped_refptr<net::URLRequestContextGetter>& | 88 const scoped_refptr<net::URLRequestContextGetter>& |
88 url_request_context_getter, | 89 url_request_context_getter, |
89 Delegate* delegate) OVERRIDE; | 90 Delegate* delegate) OVERRIDE; |
90 virtual void Load() OVERRIDE; | 91 virtual void Load() OVERRIDE; |
91 virtual void Stop() OVERRIDE; | 92 virtual void Stop() OVERRIDE; |
92 virtual void CheckOut() OVERRIDE; | 93 virtual void CheckOut() OVERRIDE; |
93 virtual void Register(const std::string& app_id, | 94 virtual void Register(const std::string& app_id, |
94 const std::vector<std::string>& sender_ids) OVERRIDE; | 95 const std::vector<std::string>& sender_ids) OVERRIDE; |
95 virtual void Unregister(const std::string& app_id) OVERRIDE; | 96 virtual void Unregister(const std::string& app_id) OVERRIDE; |
96 virtual void Send(const std::string& app_id, | 97 virtual void Send(const std::string& app_id, |
97 const std::string& receiver_id, | 98 const std::string& receiver_id, |
98 const OutgoingMessage& message) OVERRIDE; | 99 const OutgoingMessage& message) OVERRIDE; |
99 virtual void SetRecording(bool recording) OVERRIDE; | 100 virtual void SetRecording(bool recording) OVERRIDE; |
100 virtual void ClearActivityLogs() OVERRIDE; | 101 virtual void ClearActivityLogs() OVERRIDE; |
101 virtual GCMStatistics GetStatistics() const OVERRIDE; | 102 virtual GCMStatistics GetStatistics() const OVERRIDE; |
103 virtual void OnActivityRecorded() OVERRIDE; | |
102 | 104 |
103 private: | 105 private: |
104 // State representation of the GCMClient. | 106 // State representation of the GCMClient. |
105 // Any change made to this enum should have corresponding change in the | 107 // Any change made to this enum should have corresponding change in the |
106 // GetStateString(...) function. | 108 // GetStateString(...) function. |
107 enum State { | 109 enum State { |
108 // Uninitialized. | 110 // Uninitialized. |
109 UNINITIALIZED, | 111 UNINITIALIZED, |
110 // Initialized, | 112 // Initialized, |
111 INITIALIZED, | 113 INITIALIZED, |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
285 | 287 |
286 // Factory for creating references in callbacks. | 288 // Factory for creating references in callbacks. |
287 base::WeakPtrFactory<GCMClientImpl> weak_ptr_factory_; | 289 base::WeakPtrFactory<GCMClientImpl> weak_ptr_factory_; |
288 | 290 |
289 DISALLOW_COPY_AND_ASSIGN(GCMClientImpl); | 291 DISALLOW_COPY_AND_ASSIGN(GCMClientImpl); |
290 }; | 292 }; |
291 | 293 |
292 } // namespace gcm | 294 } // namespace gcm |
293 | 295 |
294 #endif // GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_ | 296 #endif // GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_ |
OLD | NEW |