OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_ENGINE_CONNECTION_FACTORY_IMPL_H_ | 5 #ifndef GOOGLE_APIS_GCM_ENGINE_CONNECTION_FACTORY_IMPL_H_ |
6 #define GOOGLE_APIS_GCM_ENGINE_CONNECTION_FACTORY_IMPL_H_ | 6 #define GOOGLE_APIS_GCM_ENGINE_CONNECTION_FACTORY_IMPL_H_ |
7 | 7 |
8 #include "google_apis/gcm/engine/connection_factory.h" | 8 #include "google_apis/gcm/engine/connection_factory.h" |
9 | 9 |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 14 matching lines...) Expand all Loading... | |
25 namespace gcm { | 25 namespace gcm { |
26 | 26 |
27 class ConnectionHandlerImpl; | 27 class ConnectionHandlerImpl; |
28 | 28 |
29 class GCM_EXPORT ConnectionFactoryImpl : | 29 class GCM_EXPORT ConnectionFactoryImpl : |
30 public ConnectionFactory, | 30 public ConnectionFactory, |
31 public net::NetworkChangeNotifier::ConnectionTypeObserver, | 31 public net::NetworkChangeNotifier::ConnectionTypeObserver, |
32 public net::NetworkChangeNotifier::IPAddressObserver { | 32 public net::NetworkChangeNotifier::IPAddressObserver { |
33 public: | 33 public: |
34 ConnectionFactoryImpl( | 34 ConnectionFactoryImpl( |
35 const GURL& mcs_endpoint, | 35 const std::vector<GURL>& mcs_endpoints, |
36 const net::BackoffEntry::Policy& backoff_policy, | 36 const net::BackoffEntry::Policy& backoff_policy, |
37 scoped_refptr<net::HttpNetworkSession> network_session, | 37 scoped_refptr<net::HttpNetworkSession> network_session, |
38 net::NetLog* net_log); | 38 net::NetLog* net_log); |
39 virtual ~ConnectionFactoryImpl(); | 39 virtual ~ConnectionFactoryImpl(); |
40 | 40 |
41 // ConnectionFactory implementation. | 41 // ConnectionFactory implementation. |
42 virtual void Initialize( | 42 virtual void Initialize( |
43 const BuildLoginRequestCallback& request_builder, | 43 const BuildLoginRequestCallback& request_builder, |
44 const ConnectionHandler::ProtoReceivedCallback& read_callback, | 44 const ConnectionHandler::ProtoReceivedCallback& read_callback, |
45 const ConnectionHandler::ProtoSentCallback& write_callback) OVERRIDE; | 45 const ConnectionHandler::ProtoSentCallback& write_callback) OVERRIDE; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
82 | 82 |
83 private: | 83 private: |
84 // Proxy resolution and connection functions. | 84 // Proxy resolution and connection functions. |
85 void OnProxyResolveDone(int status); | 85 void OnProxyResolveDone(int status); |
86 void OnProxyConnectDone(int status); | 86 void OnProxyConnectDone(int status); |
87 int ReconsiderProxyAfterError(int error); | 87 int ReconsiderProxyAfterError(int error); |
88 void ReportSuccessfulProxyConnection(); | 88 void ReportSuccessfulProxyConnection(); |
89 | 89 |
90 void CloseSocket(); | 90 void CloseSocket(); |
91 | 91 |
92 // The MCS endpoint to make connections to. | 92 // The MCS endpoints to make connections to, sorted in order of priority. |
93 const GURL mcs_endpoint_; | 93 const std::vector<GURL> mcs_endpoints_; |
94 // Index to the endpoint for a which a connection should be attempted next. | |
jianli
2014/03/20 01:11:53
nit: for which
Nicolas Zea
2014/03/20 20:10:02
Done.
| |
95 size_t current_endpoint_; | |
94 | 96 |
95 // The backoff policy to use. | 97 // The backoff policy to use. |
96 const net::BackoffEntry::Policy backoff_policy_; | 98 const net::BackoffEntry::Policy backoff_policy_; |
97 | 99 |
98 // ---- net:: components for establishing connections. ---- | 100 // ---- net:: components for establishing connections. ---- |
99 // Network session for creating new connections. | 101 // Network session for creating new connections. |
100 const scoped_refptr<net::HttpNetworkSession> network_session_; | 102 const scoped_refptr<net::HttpNetworkSession> network_session_; |
101 // Net log to use in connection attempts. | 103 // Net log to use in connection attempts. |
102 net::BoundNetLog bound_net_log_; | 104 net::BoundNetLog bound_net_log_; |
103 // The current PAC request, if one exists. Owned by the proxy service. | 105 // The current PAC request, if one exists. Owned by the proxy service. |
(...skipping 29 matching lines...) Expand all Loading... | |
133 BuildLoginRequestCallback request_builder_; | 135 BuildLoginRequestCallback request_builder_; |
134 | 136 |
135 base::WeakPtrFactory<ConnectionFactoryImpl> weak_ptr_factory_; | 137 base::WeakPtrFactory<ConnectionFactoryImpl> weak_ptr_factory_; |
136 | 138 |
137 DISALLOW_COPY_AND_ASSIGN(ConnectionFactoryImpl); | 139 DISALLOW_COPY_AND_ASSIGN(ConnectionFactoryImpl); |
138 }; | 140 }; |
139 | 141 |
140 } // namespace gcm | 142 } // namespace gcm |
141 | 143 |
142 #endif // GOOGLE_APIS_GCM_ENGINE_CONNECTION_FACTORY_IMPL_H_ | 144 #endif // GOOGLE_APIS_GCM_ENGINE_CONNECTION_FACTORY_IMPL_H_ |
OLD | NEW |