OLD | NEW |
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 COMPONENTS_GCM_DRIVER_GCM_CLIENT_IMPL_H_ | 5 #ifndef COMPONENTS_GCM_DRIVER_GCM_CLIENT_IMPL_H_ |
6 #define COMPONENTS_GCM_DRIVER_GCM_CLIENT_IMPL_H_ | 6 #define COMPONENTS_GCM_DRIVER_GCM_CLIENT_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 73 |
74 // Implements the GCM Client. It is used to coordinate MCS Client (communication | 74 // Implements the GCM Client. It is used to coordinate MCS Client (communication |
75 // with MCS) and other pieces of GCM infrastructure like Registration and | 75 // with MCS) and other pieces of GCM infrastructure like Registration and |
76 // Checkins. It also allows for registering user delegates that host | 76 // Checkins. It also allows for registering user delegates that host |
77 // applications that send and receive messages. | 77 // applications that send and receive messages. |
78 class GCMClientImpl | 78 class GCMClientImpl |
79 : public GCMClient, public GCMStatsRecorder::Delegate, | 79 : public GCMClient, public GCMStatsRecorder::Delegate, |
80 public ConnectionFactory::ConnectionListener { | 80 public ConnectionFactory::ConnectionListener { |
81 public: | 81 public: |
82 explicit GCMClientImpl(scoped_ptr<GCMInternalsBuilder> internals_builder); | 82 explicit GCMClientImpl(scoped_ptr<GCMInternalsBuilder> internals_builder); |
83 virtual ~GCMClientImpl(); | 83 ~GCMClientImpl() override; |
84 | 84 |
85 // GCMClient implementation. | 85 // GCMClient implementation. |
86 virtual void Initialize( | 86 void Initialize( |
87 const ChromeBuildInfo& chrome_build_info, | 87 const ChromeBuildInfo& chrome_build_info, |
88 const base::FilePath& store_path, | 88 const base::FilePath& store_path, |
89 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner, | 89 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner, |
90 const scoped_refptr<net::URLRequestContextGetter>& | 90 const scoped_refptr<net::URLRequestContextGetter>& |
91 url_request_context_getter, | 91 url_request_context_getter, |
92 scoped_ptr<Encryptor> encryptor, | 92 scoped_ptr<Encryptor> encryptor, |
93 GCMClient::Delegate* delegate) override; | 93 GCMClient::Delegate* delegate) override; |
94 virtual void Start() override; | 94 void Start() override; |
95 virtual void Stop() override; | 95 void Stop() override; |
96 virtual void CheckOut() override; | 96 void CheckOut() override; |
97 virtual void Register(const std::string& app_id, | 97 void Register(const std::string& app_id, |
98 const std::vector<std::string>& sender_ids) override; | 98 const std::vector<std::string>& sender_ids) override; |
99 virtual void Unregister(const std::string& app_id) override; | 99 void Unregister(const std::string& app_id) override; |
100 virtual void Send(const std::string& app_id, | 100 void Send(const std::string& app_id, |
101 const std::string& receiver_id, | 101 const std::string& receiver_id, |
102 const OutgoingMessage& message) override; | 102 const OutgoingMessage& message) override; |
103 virtual void SetRecording(bool recording) override; | 103 void SetRecording(bool recording) override; |
104 virtual void ClearActivityLogs() override; | 104 void ClearActivityLogs() override; |
105 virtual GCMStatistics GetStatistics() const override; | 105 GCMStatistics GetStatistics() const override; |
106 virtual void SetAccountTokens( | 106 void SetAccountTokens( |
107 const std::vector<AccountTokenInfo>& account_tokens) override; | 107 const std::vector<AccountTokenInfo>& account_tokens) override; |
108 virtual void UpdateAccountMapping( | 108 void UpdateAccountMapping(const AccountMapping& account_mapping) override; |
109 const AccountMapping& account_mapping) override; | 109 void RemoveAccountMapping(const std::string& account_id) override; |
110 virtual void RemoveAccountMapping(const std::string& account_id) override; | |
111 | 110 |
112 // GCMStatsRecorder::Delegate implemenation. | 111 // GCMStatsRecorder::Delegate implemenation. |
113 virtual void OnActivityRecorded() override; | 112 void OnActivityRecorded() override; |
114 | 113 |
115 // ConnectionFactory::ConnectionListener implementation. | 114 // ConnectionFactory::ConnectionListener implementation. |
116 virtual void OnConnected(const GURL& current_server, | 115 void OnConnected(const GURL& current_server, |
117 const net::IPEndPoint& ip_endpoint) override; | 116 const net::IPEndPoint& ip_endpoint) override; |
118 virtual void OnDisconnected() override; | 117 void OnDisconnected() override; |
119 | 118 |
120 private: | 119 private: |
121 // State representation of the GCMClient. | 120 // State representation of the GCMClient. |
122 // Any change made to this enum should have corresponding change in the | 121 // Any change made to this enum should have corresponding change in the |
123 // GetStateString(...) function. | 122 // GetStateString(...) function. |
124 enum State { | 123 enum State { |
125 // Uninitialized. | 124 // Uninitialized. |
126 UNINITIALIZED, | 125 UNINITIALIZED, |
127 // Initialized, | 126 // Initialized, |
128 INITIALIZED, | 127 INITIALIZED, |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 | 318 |
320 // Factory for creating references in callbacks. | 319 // Factory for creating references in callbacks. |
321 base::WeakPtrFactory<GCMClientImpl> weak_ptr_factory_; | 320 base::WeakPtrFactory<GCMClientImpl> weak_ptr_factory_; |
322 | 321 |
323 DISALLOW_COPY_AND_ASSIGN(GCMClientImpl); | 322 DISALLOW_COPY_AND_ASSIGN(GCMClientImpl); |
324 }; | 323 }; |
325 | 324 |
326 } // namespace gcm | 325 } // namespace gcm |
327 | 326 |
328 #endif // COMPONENTS_GCM_DRIVER_GCM_CLIENT_IMPL_H_ | 327 #endif // COMPONENTS_GCM_DRIVER_GCM_CLIENT_IMPL_H_ |
OLD | NEW |