OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/io_thread.h" | 5 #include "chrome/browser/io_thread.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 net::NetworkChangeNotifier::AddNetworkChangeObserver(this); | 326 net::NetworkChangeNotifier::AddNetworkChangeObserver(this); |
327 } | 327 } |
328 | 328 |
329 virtual ~LoggingNetworkChangeObserver() { | 329 virtual ~LoggingNetworkChangeObserver() { |
330 net::NetworkChangeNotifier::RemoveIPAddressObserver(this); | 330 net::NetworkChangeNotifier::RemoveIPAddressObserver(this); |
331 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this); | 331 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this); |
332 net::NetworkChangeNotifier::RemoveNetworkChangeObserver(this); | 332 net::NetworkChangeNotifier::RemoveNetworkChangeObserver(this); |
333 } | 333 } |
334 | 334 |
335 // NetworkChangeNotifier::IPAddressObserver implementation. | 335 // NetworkChangeNotifier::IPAddressObserver implementation. |
336 virtual void OnIPAddressChanged() OVERRIDE { | 336 virtual void OnIPAddressChanged() override { |
337 VLOG(1) << "Observed a change to the network IP addresses"; | 337 VLOG(1) << "Observed a change to the network IP addresses"; |
338 | 338 |
339 net_log_->AddGlobalEntry(net::NetLog::TYPE_NETWORK_IP_ADDRESSES_CHANGED); | 339 net_log_->AddGlobalEntry(net::NetLog::TYPE_NETWORK_IP_ADDRESSES_CHANGED); |
340 } | 340 } |
341 | 341 |
342 // NetworkChangeNotifier::ConnectionTypeObserver implementation. | 342 // NetworkChangeNotifier::ConnectionTypeObserver implementation. |
343 virtual void OnConnectionTypeChanged( | 343 virtual void OnConnectionTypeChanged( |
344 net::NetworkChangeNotifier::ConnectionType type) OVERRIDE { | 344 net::NetworkChangeNotifier::ConnectionType type) override { |
345 std::string type_as_string = | 345 std::string type_as_string = |
346 net::NetworkChangeNotifier::ConnectionTypeToString(type); | 346 net::NetworkChangeNotifier::ConnectionTypeToString(type); |
347 | 347 |
348 VLOG(1) << "Observed a change to network connectivity state " | 348 VLOG(1) << "Observed a change to network connectivity state " |
349 << type_as_string; | 349 << type_as_string; |
350 | 350 |
351 net_log_->AddGlobalEntry( | 351 net_log_->AddGlobalEntry( |
352 net::NetLog::TYPE_NETWORK_CONNECTIVITY_CHANGED, | 352 net::NetLog::TYPE_NETWORK_CONNECTIVITY_CHANGED, |
353 net::NetLog::StringCallback("new_connection_type", &type_as_string)); | 353 net::NetLog::StringCallback("new_connection_type", &type_as_string)); |
354 } | 354 } |
355 | 355 |
356 // NetworkChangeNotifier::NetworkChangeObserver implementation. | 356 // NetworkChangeNotifier::NetworkChangeObserver implementation. |
357 virtual void OnNetworkChanged( | 357 virtual void OnNetworkChanged( |
358 net::NetworkChangeNotifier::ConnectionType type) OVERRIDE { | 358 net::NetworkChangeNotifier::ConnectionType type) override { |
359 std::string type_as_string = | 359 std::string type_as_string = |
360 net::NetworkChangeNotifier::ConnectionTypeToString(type); | 360 net::NetworkChangeNotifier::ConnectionTypeToString(type); |
361 | 361 |
362 VLOG(1) << "Observed a network change to state " << type_as_string; | 362 VLOG(1) << "Observed a network change to state " << type_as_string; |
363 | 363 |
364 net_log_->AddGlobalEntry( | 364 net_log_->AddGlobalEntry( |
365 net::NetLog::TYPE_NETWORK_CHANGED, | 365 net::NetLog::TYPE_NETWORK_CHANGED, |
366 net::NetLog::StringCallback("new_connection_type", &type_as_string)); | 366 net::NetLog::StringCallback("new_connection_type", &type_as_string)); |
367 } | 367 } |
368 | 368 |
369 private: | 369 private: |
370 net::NetLog* net_log_; | 370 net::NetLog* net_log_; |
371 DISALLOW_COPY_AND_ASSIGN(LoggingNetworkChangeObserver); | 371 DISALLOW_COPY_AND_ASSIGN(LoggingNetworkChangeObserver); |
372 }; | 372 }; |
373 | 373 |
374 class SystemURLRequestContextGetter : public net::URLRequestContextGetter { | 374 class SystemURLRequestContextGetter : public net::URLRequestContextGetter { |
375 public: | 375 public: |
376 explicit SystemURLRequestContextGetter(IOThread* io_thread); | 376 explicit SystemURLRequestContextGetter(IOThread* io_thread); |
377 | 377 |
378 // Implementation for net::UrlRequestContextGetter. | 378 // Implementation for net::UrlRequestContextGetter. |
379 virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE; | 379 virtual net::URLRequestContext* GetURLRequestContext() override; |
380 virtual scoped_refptr<base::SingleThreadTaskRunner> | 380 virtual scoped_refptr<base::SingleThreadTaskRunner> |
381 GetNetworkTaskRunner() const OVERRIDE; | 381 GetNetworkTaskRunner() const override; |
382 | 382 |
383 protected: | 383 protected: |
384 virtual ~SystemURLRequestContextGetter(); | 384 virtual ~SystemURLRequestContextGetter(); |
385 | 385 |
386 private: | 386 private: |
387 IOThread* const io_thread_; // Weak pointer, owned by BrowserProcess. | 387 IOThread* const io_thread_; // Weak pointer, owned by BrowserProcess. |
388 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; | 388 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; |
389 | 389 |
390 base::debug::LeakTracker<SystemURLRequestContextGetter> leak_tracker_; | 390 base::debug::LeakTracker<SystemURLRequestContextGetter> leak_tracker_; |
391 }; | 391 }; |
(...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1412 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); | 1412 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); |
1413 for (size_t i = 0; i < supported_versions.size(); ++i) { | 1413 for (size_t i = 0; i < supported_versions.size(); ++i) { |
1414 net::QuicVersion version = supported_versions[i]; | 1414 net::QuicVersion version = supported_versions[i]; |
1415 if (net::QuicVersionToString(version) == quic_version) { | 1415 if (net::QuicVersionToString(version) == quic_version) { |
1416 return version; | 1416 return version; |
1417 } | 1417 } |
1418 } | 1418 } |
1419 | 1419 |
1420 return net::QUIC_VERSION_UNSUPPORTED; | 1420 return net::QUIC_VERSION_UNSUPPORTED; |
1421 } | 1421 } |
OLD | NEW |