OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chromeos/net/wake_on_wifi_manager.h" | 5 #include "chrome/browser/chromeos/net/wake_on_wifi_manager.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/containers/scoped_ptr_hash_map.h" | 10 #include "base/containers/scoped_ptr_hash_map.h" |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 current_feature_ = NOT_SUPPORTED; | 300 current_feature_ = NOT_SUPPORTED; |
301 connection_observers_.clear(); | 301 connection_observers_.clear(); |
302 NetworkHandler::Get()->network_state_handler()->RemoveObserver(this, | 302 NetworkHandler::Get()->network_state_handler()->RemoveObserver(this, |
303 FROM_HERE); | 303 FROM_HERE); |
304 registrar_.RemoveAll(); | 304 registrar_.RemoveAll(); |
305 extension_event_observer_.reset(); | 305 extension_event_observer_.reset(); |
306 | 306 |
307 return; | 307 return; |
308 } | 308 } |
309 | 309 |
| 310 // We always resend the wake on wifi setting unless it hasn't been set yet. |
| 311 // This covers situations where shill restarts or ends up recreating the wifi |
| 312 // device (crbug.com/475199). |
| 313 if (current_feature_ != INVALID) |
| 314 HandleWakeOnWifiFeatureUpdated(); |
| 315 |
310 if (wifi_properties_received_) | 316 if (wifi_properties_received_) |
311 return; | 317 return; |
312 | 318 |
313 wifi_properties_received_ = true; | 319 wifi_properties_received_ = true; |
314 | 320 |
315 if (current_feature_ != INVALID) | |
316 HandleWakeOnWifiFeatureUpdated(); | |
317 | |
318 NetworkHandler::Get() | 321 NetworkHandler::Get() |
319 ->network_device_handler() | 322 ->network_device_handler() |
320 ->RemoveAllWifiWakeOnPacketConnections(base::Bind(&base::DoNothing), | 323 ->RemoveAllWifiWakeOnPacketConnections(base::Bind(&base::DoNothing), |
321 network_handler::ErrorCallback()); | 324 network_handler::ErrorCallback()); |
322 | 325 |
323 for (const auto& kv_pair : connection_observers_) { | 326 for (const auto& kv_pair : connection_observers_) { |
324 WakeOnPacketConnectionObserver* observer = kv_pair.second; | 327 WakeOnPacketConnectionObserver* observer = kv_pair.second; |
325 observer->HandleWifiDevicePropertiesReady(); | 328 observer->HandleWifiDevicePropertiesReady(); |
326 } | 329 } |
327 } | 330 } |
(...skipping 12 matching lines...) Expand all Loading... |
340 ->WakeFromSuspendForHeartbeat( | 343 ->WakeFromSuspendForHeartbeat( |
341 IsWakeOnPacketEnabled(current_feature_)); | 344 IsWakeOnPacketEnabled(current_feature_)); |
342 } | 345 } |
343 } | 346 } |
344 | 347 |
345 void WakeOnWifiManager::OnProfileDestroyed(Profile* profile) { | 348 void WakeOnWifiManager::OnProfileDestroyed(Profile* profile) { |
346 connection_observers_.erase(profile); | 349 connection_observers_.erase(profile); |
347 } | 350 } |
348 | 351 |
349 } // namespace chromeos | 352 } // namespace chromeos |
OLD | NEW |