Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chromecast/net/connectivity_checker.h" | 5 #include "chromecast/net/connectivity_checker.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "chromecast/net/net_switches.h" | 10 #include "chromecast/net/net_switches.h" |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 28 // changed to offline | 28 // changed to offline |
| 29 const unsigned int kNumBadResponses = 3; | 29 const unsigned int kNumBadResponses = 3; |
| 30 | 30 |
| 31 // Default url for connectivity checking. | 31 // Default url for connectivity checking. |
| 32 const char kDefaultConnectivityCheckUrl[] = | 32 const char kDefaultConnectivityCheckUrl[] = |
| 33 "https://clients3.google.com/generate_204"; | 33 "https://clients3.google.com/generate_204"; |
| 34 | 34 |
| 35 } // namespace | 35 } // namespace |
| 36 | 36 |
| 37 ConnectivityChecker::ConnectivityChecker( | 37 ConnectivityChecker::ConnectivityChecker( |
| 38 const scoped_refptr<base::MessageLoopProxy>& loop_proxy) | 38 const scoped_refptr<base::SingleThreadTaskRunner>& loop_proxy) |
|
lcwu1
2015/05/19 01:45:38
Ditto.
gunsch
2015/05/19 03:01:58
Done.
| |
| 39 : connectivity_observer_list_( | 39 : connectivity_observer_list_( |
| 40 new ObserverListThreadSafe<ConnectivityObserver>()), | 40 new ObserverListThreadSafe<ConnectivityObserver>()), |
| 41 loop_proxy_(loop_proxy), | 41 loop_proxy_(loop_proxy), |
| 42 connected_(false), | 42 connected_(false), |
| 43 bad_responses_(0) { | 43 bad_responses_(0) { |
| 44 DCHECK(loop_proxy_.get()); | 44 DCHECK(loop_proxy_.get()); |
| 45 loop_proxy->PostTask(FROM_HERE, | 45 loop_proxy->PostTask(FROM_HERE, |
| 46 base::Bind(&ConnectivityChecker::Initialize, this)); | 46 base::Bind(&ConnectivityChecker::Initialize, this)); |
| 47 } | 47 } |
| 48 | 48 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 175 } | 175 } |
| 176 | 176 |
| 177 void ConnectivityChecker::Cancel() { | 177 void ConnectivityChecker::Cancel() { |
| 178 if (url_request_.get()) { | 178 if (url_request_.get()) { |
| 179 VLOG(2) << "Cancel connectivity check in progress"; | 179 VLOG(2) << "Cancel connectivity check in progress"; |
| 180 url_request_.reset(NULL); // URLRequest::Cancel() is called in destructor. | 180 url_request_.reset(NULL); // URLRequest::Cancel() is called in destructor. |
| 181 } | 181 } |
| 182 } | 182 } |
| 183 | 183 |
| 184 } // namespace chromecast | 184 } // namespace chromecast |
| OLD | NEW |