| Index: net/base/network_change_notifier_win.cc
|
| diff --git a/net/base/network_change_notifier_win.cc b/net/base/network_change_notifier_win.cc
|
| index 225568192f2af9a4aaede50fefac1dbefdae053f..3952e35f6854414da25cc144b804fa6244b21714 100644
|
| --- a/net/base/network_change_notifier_win.cc
|
| +++ b/net/base/network_change_notifier_win.cc
|
| @@ -33,18 +33,14 @@ class NetworkChangeNotifierWin::DnsConfigServiceThread : public base::Thread {
|
| public:
|
| DnsConfigServiceThread() : base::Thread("DnsConfigService") {}
|
|
|
| - virtual ~DnsConfigServiceThread() {
|
| - Stop();
|
| - }
|
| + virtual ~DnsConfigServiceThread() { Stop(); }
|
|
|
| virtual void Init() override {
|
| service_ = DnsConfigService::CreateSystemService();
|
| service_->WatchConfig(base::Bind(&NetworkChangeNotifier::SetDnsConfig));
|
| }
|
|
|
| - virtual void CleanUp() override {
|
| - service_.reset();
|
| - }
|
| + virtual void CleanUp() override { service_.reset(); }
|
|
|
| private:
|
| scoped_ptr<DnsConfigService> service_;
|
| @@ -59,8 +55,8 @@ NetworkChangeNotifierWin::NetworkChangeNotifierWin()
|
| weak_factory_(this),
|
| dns_config_service_thread_(new DnsConfigServiceThread()),
|
| last_computed_connection_type_(RecomputeCurrentConnectionType()),
|
| - last_announced_offline_(
|
| - last_computed_connection_type_ == CONNECTION_NONE) {
|
| + last_announced_offline_(last_computed_connection_type_ ==
|
| + CONNECTION_NONE) {
|
| memset(&addr_overlapped_, 0, sizeof addr_overlapped_);
|
| addr_overlapped_.hEvent = WSACreateEvent();
|
| }
|
| @@ -153,8 +149,7 @@ NetworkChangeNotifierWin::RecomputeCurrentConnectionType() const {
|
| query_set.dwNameSpace = NS_NLA;
|
| // Initiate a client query to iterate through the
|
| // currently connected networks.
|
| - if (0 != WSALookupServiceBegin(&query_set, LUP_RETURN_ALL,
|
| - &ws_handle)) {
|
| + if (0 != WSALookupServiceBegin(&query_set, LUP_RETURN_ALL, &ws_handle)) {
|
| LOG(ERROR) << "WSALookupServiceBegin failed with: " << WSAGetLastError();
|
| return NetworkChangeNotifier::CONNECTION_UNKNOWN;
|
| }
|
| @@ -170,11 +165,11 @@ NetworkChangeNotifierWin::RecomputeCurrentConnectionType() const {
|
| DWORD length = sizeof(result_buffer);
|
| reinterpret_cast<WSAQUERYSET*>(&result_buffer[0])->dwSize =
|
| sizeof(WSAQUERYSET);
|
| - int result = WSALookupServiceNext(
|
| - ws_handle,
|
| - LUP_RETURN_NAME,
|
| - &length,
|
| - reinterpret_cast<WSAQUERYSET*>(&result_buffer[0]));
|
| + int result =
|
| + WSALookupServiceNext(ws_handle,
|
| + LUP_RETURN_NAME,
|
| + &length,
|
| + reinterpret_cast<WSAQUERYSET*>(&result_buffer[0]));
|
|
|
| if (result == 0) {
|
| // Found a connection!
|
| @@ -198,12 +193,11 @@ NetworkChangeNotifierWin::RecomputeCurrentConnectionType() const {
|
| }
|
|
|
| result = WSALookupServiceEnd(ws_handle);
|
| - LOG_IF(ERROR, result != 0)
|
| - << "WSALookupServiceEnd() failed with: " << result;
|
| + LOG_IF(ERROR, result != 0) << "WSALookupServiceEnd() failed with: " << result;
|
|
|
| // TODO(droger): Return something more detailed than CONNECTION_UNKNOWN.
|
| - return found_connection ? NetworkChangeNotifier::CONNECTION_UNKNOWN :
|
| - NetworkChangeNotifier::CONNECTION_NONE;
|
| + return found_connection ? NetworkChangeNotifier::CONNECTION_UNKNOWN
|
| + : NetworkChangeNotifier::CONNECTION_NONE;
|
| }
|
|
|
| NetworkChangeNotifier::ConnectionType
|
| @@ -247,7 +241,9 @@ void NetworkChangeNotifierWin::NotifyObservers() {
|
| // If after one second we determine we are still offline, we will
|
| // delay again.
|
| offline_polls_ = 0;
|
| - timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(1), this,
|
| + timer_.Start(FROM_HERE,
|
| + base::TimeDelta::FromSeconds(1),
|
| + this,
|
| &NetworkChangeNotifierWin::NotifyParentOfConnectionTypeChange);
|
| }
|
|
|
| @@ -298,7 +294,7 @@ bool NetworkChangeNotifierWin::WatchForAddressChangeInternal() {
|
|
|
| if (!dns_config_service_thread_->IsRunning()) {
|
| dns_config_service_thread_->StartWithOptions(
|
| - base::Thread::Options(base::MessageLoop::TYPE_IO, 0));
|
| + base::Thread::Options(base::MessageLoop::TYPE_IO, 0));
|
| }
|
|
|
| HANDLE handle = NULL;
|
| @@ -319,7 +315,9 @@ void NetworkChangeNotifierWin::NotifyParentOfConnectionTypeChange() {
|
| // we may not detect the transition to online state after 1 second but within
|
| // 20 seconds we generally do.
|
| if (last_announced_offline_ && current_offline && offline_polls_ <= 20) {
|
| - timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(1), this,
|
| + timer_.Start(FROM_HERE,
|
| + base::TimeDelta::FromSeconds(1),
|
| + this,
|
| &NetworkChangeNotifierWin::NotifyParentOfConnectionTypeChange);
|
| return;
|
| }
|
|
|