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

Unified Diff: chromecast/net/connectivity_checker.cc

Issue 995933002: Observe IP address change in connectivity_checker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src/@master
Patch Set: Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chromecast/net/connectivity_checker.cc
diff --git a/chromecast/net/connectivity_checker.cc b/chromecast/net/connectivity_checker.cc
index 0c78b5d93aafe782076b476bde524ff87ed95366..8dce954e94fb40ee5adda4bd5010b76e5b4c06fb 100644
--- a/chromecast/net/connectivity_checker.cc
+++ b/chromecast/net/connectivity_checker.cc
@@ -60,12 +60,15 @@ void ConnectivityChecker::Initialize() {
url_request_context_.reset(builder.Build());
net::NetworkChangeNotifier::AddConnectionTypeObserver(this);
+ net::NetworkChangeNotifier::AddIPAddressObserver(this);
loop_proxy_->PostTask(FROM_HERE,
base::Bind(&ConnectivityChecker::Check, this));
}
ConnectivityChecker::~ConnectivityChecker() {
DCHECK(loop_proxy_.get());
+ net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this);
+ net::NetworkChangeNotifier::RemoveIPAddressObserver(this);
byungchul 2015/03/11 17:18:03 reverse the order.
wzhong 2015/03/11 17:38:20 Done.
loop_proxy_->DeleteSoon(FROM_HERE, url_request_context_.release());
loop_proxy_->DeleteSoon(FROM_HERE, url_request_.release());
}
@@ -116,6 +119,7 @@ void ConnectivityChecker::Check() {
void ConnectivityChecker::OnConnectionTypeChanged(
net::NetworkChangeNotifier::ConnectionType type) {
+ VLOG(2) << "OnConnectionTypeChanged " << type;
if (type == net::NetworkChangeNotifier::CONNECTION_NONE)
SetConnectivity(false);
@@ -123,6 +127,14 @@ void ConnectivityChecker::OnConnectionTypeChanged(
Check();
}
+void ConnectivityChecker::OnIPAddressChanged() {
+ VLOG(2) << "OnIPAddressChanged";
+
+ SetConnectivity(false);
byungchul 2015/03/11 17:18:03 Please comment why it sets connectivity false. Sho
derekjchow1 2015/03/11 17:25:00 Don't SetConnectivity here since NetworkChangeNoti
wzhong 2015/03/11 17:38:20 Removed. Triggering a connectivity checking is suf
+ Cancel();
+ Check();
+}
+
void ConnectivityChecker::OnResponseStarted(net::URLRequest* request) {
int http_response_code =
(request->status().is_success() &&
« chromecast/net/connectivity_checker.h ('K') | « chromecast/net/connectivity_checker.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698