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

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

Issue 317723004: [GCM] Add ConnectionListener support, and hook up to debug page (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 76 class GCM_EXPORT GCMClientImpl
77 : public GCMClient, public GCMStatsRecorder::Delegate { 77 : public GCMClient, public GCMStatsRecorder::Delegate,
78 public ConnectionFactory::ConnectionListener {
78 public: 79 public:
79 explicit GCMClientImpl(scoped_ptr<GCMInternalsBuilder> internals_builder); 80 explicit GCMClientImpl(scoped_ptr<GCMInternalsBuilder> internals_builder);
80 virtual ~GCMClientImpl(); 81 virtual ~GCMClientImpl();
81 82
82 // Overridden from GCMClient: 83 // GCMClient implementation.
83 virtual void Initialize( 84 virtual void Initialize(
84 const ChromeBuildInfo& chrome_build_info, 85 const ChromeBuildInfo& chrome_build_info,
85 const base::FilePath& store_path, 86 const base::FilePath& store_path,
86 const std::vector<std::string>& account_ids, 87 const std::vector<std::string>& account_ids,
87 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner, 88 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner,
88 const scoped_refptr<net::URLRequestContextGetter>& 89 const scoped_refptr<net::URLRequestContextGetter>&
89 url_request_context_getter, 90 url_request_context_getter,
90 scoped_ptr<Encryptor> encryptor, 91 scoped_ptr<Encryptor> encryptor,
91 GCMClient::Delegate* delegate) OVERRIDE; 92 GCMClient::Delegate* delegate) OVERRIDE;
92 virtual void Start() OVERRIDE; 93 virtual void Start() OVERRIDE;
93 virtual void Stop() OVERRIDE; 94 virtual void Stop() OVERRIDE;
94 virtual void CheckOut() OVERRIDE; 95 virtual void CheckOut() OVERRIDE;
95 virtual void Register(const std::string& app_id, 96 virtual void Register(const std::string& app_id,
96 const std::vector<std::string>& sender_ids) OVERRIDE; 97 const std::vector<std::string>& sender_ids) OVERRIDE;
97 virtual void Unregister(const std::string& app_id) OVERRIDE; 98 virtual void Unregister(const std::string& app_id) OVERRIDE;
98 virtual void Send(const std::string& app_id, 99 virtual void Send(const std::string& app_id,
99 const std::string& receiver_id, 100 const std::string& receiver_id,
100 const OutgoingMessage& message) OVERRIDE; 101 const OutgoingMessage& message) OVERRIDE;
101 virtual void SetRecording(bool recording) OVERRIDE; 102 virtual void SetRecording(bool recording) OVERRIDE;
102 virtual void ClearActivityLogs() OVERRIDE; 103 virtual void ClearActivityLogs() OVERRIDE;
103 virtual GCMStatistics GetStatistics() const OVERRIDE; 104 virtual GCMStatistics GetStatistics() const OVERRIDE;
105
106 // GCMStatsRecorder::Delegate implemenation.
104 virtual void OnActivityRecorded() OVERRIDE; 107 virtual void OnActivityRecorded() OVERRIDE;
105 108
109 // ConnectionFactory::ConnectionListener implementation.
110 virtual void OnConnected(const GURL& current_endpoint,
111 const net::IPEndPoint& socket_ip) OVERRIDE;
112 virtual void OnDisconnected() OVERRIDE;
113
106 private: 114 private:
107 // State representation of the GCMClient. 115 // State representation of the GCMClient.
108 // Any change made to this enum should have corresponding change in the 116 // Any change made to this enum should have corresponding change in the
109 // GetStateString(...) function. 117 // GetStateString(...) function.
110 enum State { 118 enum State {
111 // Uninitialized. 119 // Uninitialized.
112 UNINITIALIZED, 120 UNINITIALIZED,
113 // Initialized, 121 // Initialized,
114 INITIALIZED, 122 INITIALIZED,
115 // GCM store loading is in progress. 123 // GCM store loading is in progress.
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 300
293 // Factory for creating references in callbacks. 301 // Factory for creating references in callbacks.
294 base::WeakPtrFactory<GCMClientImpl> weak_ptr_factory_; 302 base::WeakPtrFactory<GCMClientImpl> weak_ptr_factory_;
295 303
296 DISALLOW_COPY_AND_ASSIGN(GCMClientImpl); 304 DISALLOW_COPY_AND_ASSIGN(GCMClientImpl);
297 }; 305 };
298 306
299 } // namespace gcm 307 } // namespace gcm
300 308
301 #endif // GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_ 309 #endif // GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698