diff options
author | droger@google.com <droger@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-24 11:30:05 +0000 |
---|---|---|
committer | droger@google.com <droger@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-24 11:30:05 +0000 |
commit | 8bbc7a79b07a8ea33b356492947ad8d455ab438a (patch) | |
tree | 2b7e728f0eb8467d51390846d1059595347a1d36 /remoting/host/signaling_connector.cc | |
parent | 9f230ed18793828c7f1776189b5b66a5b5f07771 (diff) | |
download | chromium_src-8bbc7a79b07a8ea33b356492947ad8d455ab438a.zip chromium_src-8bbc7a79b07a8ea33b356492947ad8d455ab438a.tar.gz chromium_src-8bbc7a79b07a8ea33b356492947ad8d455ab438a.tar.bz2 |
Support for navigator.connection API
This replaces the online state (a boolean) by a more complex state (UNKNOWN/NONE
/2G/3G/4G/WIFI/ETHERNET) inspired by the Network Information API
(http://www.w3.org/TR/netinfo-api/).
Breakdown of the modified files:
- network_change_notifier.h/.cc: actual API change
- network_change_notifier_*: platform specific implementations. This CL only provide a basic implementation where CONNECTION_UNKNOWN is returned when online and CONNECTION_NONE is returned when offline.
- other files: call sites for the static function and observer implementations. Most of the time this only changes the test IsOffline() by (GetConnectionType() == CONNECTION_NONE).
BUG=112937
TEST=NONE
Review URL: https://chromiumcodereview.appspot.com/9147026
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@138780 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host/signaling_connector.cc')
-rw-r--r-- | remoting/host/signaling_connector.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/remoting/host/signaling_connector.cc b/remoting/host/signaling_connector.cc index a9bef15..e93c398 100644 --- a/remoting/host/signaling_connector.cc +++ b/remoting/host/signaling_connector.cc @@ -39,7 +39,7 @@ SignalingConnector::SignalingConnector( reconnect_attempts_(0), refreshing_oauth_token_(false) { DCHECK(!auth_failed_callback_.is_null()); - net::NetworkChangeNotifier::AddOnlineStateObserver(this); + net::NetworkChangeNotifier::AddConnectionTypeObserver(this); net::NetworkChangeNotifier::AddIPAddressObserver(this); signal_strategy_->AddListener(this); ScheduleTryReconnect(); @@ -47,7 +47,7 @@ SignalingConnector::SignalingConnector( SignalingConnector::~SignalingConnector() { signal_strategy_->RemoveListener(this); - net::NetworkChangeNotifier::RemoveOnlineStateObserver(this); + net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this); net::NetworkChangeNotifier::RemoveIPAddressObserver(this); } @@ -86,9 +86,10 @@ void SignalingConnector::OnIPAddressChanged() { ResetAndTryReconnect(); } -void SignalingConnector::OnOnlineStateChanged(bool online) { +void SignalingConnector::OnConnectionTypeChanged( + net::NetworkChangeNotifier::ConnectionType type) { DCHECK(CalledOnValidThread()); - if (online) { + if (type != net::NetworkChangeNotifier::CONNECTION_NONE) { LOG(INFO) << "Network state changed to online."; ResetAndTryReconnect(); } |