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 <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 const DeviceState* device = | 173 const DeviceState* device = |
174 NetworkHandler::Get()->network_state_handler()->GetDeviceStateByType( | 174 NetworkHandler::Get()->network_state_handler()->GetDeviceStateByType( |
175 NetworkTypePattern::WiFi()); | 175 NetworkTypePattern::WiFi()); |
176 if (!device) | 176 if (!device) |
177 return; | 177 return; |
178 | 178 |
179 std::string feature_string(WakeOnWifiFeatureToString(current_feature_)); | 179 std::string feature_string(WakeOnWifiFeatureToString(current_feature_)); |
180 DCHECK(!feature_string.empty()); | 180 DCHECK(!feature_string.empty()); |
181 | 181 |
182 NetworkHandler::Get()->network_device_handler()->SetDeviceProperty( | 182 NetworkHandler::Get()->network_device_handler()->SetDeviceProperty( |
183 device->path(), | 183 device->path(), shill::kWakeOnWiFiFeaturesEnabledProperty, |
184 shill::kWakeOnWiFiFeaturesEnabledProperty, | 184 base::Value(feature_string), base::Bind(&base::DoNothing), |
185 base::StringValue(feature_string), | |
186 base::Bind(&base::DoNothing), | |
187 network_handler::ErrorCallback()); | 185 network_handler::ErrorCallback()); |
188 | 186 |
189 bool wake_on_packet_enabled = IsWakeOnPacketEnabled(current_feature_); | 187 bool wake_on_packet_enabled = IsWakeOnPacketEnabled(current_feature_); |
190 for (const auto& kv_pair : connection_observers_) { | 188 for (const auto& kv_pair : connection_observers_) { |
191 Profile* profile = kv_pair.first; | 189 Profile* profile = kv_pair.first; |
192 gcm::GCMProfileServiceFactory::GetForProfile(profile) | 190 gcm::GCMProfileServiceFactory::GetForProfile(profile) |
193 ->driver() | 191 ->driver() |
194 ->WakeFromSuspendForHeartbeat(wake_on_packet_enabled); | 192 ->WakeFromSuspendForHeartbeat(wake_on_packet_enabled); |
195 } | 193 } |
196 | 194 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 ->driver() | 264 ->driver() |
267 ->WakeFromSuspendForHeartbeat( | 265 ->WakeFromSuspendForHeartbeat( |
268 IsWakeOnPacketEnabled(current_feature_)); | 266 IsWakeOnPacketEnabled(current_feature_)); |
269 } | 267 } |
270 | 268 |
271 void WakeOnWifiManager::OnProfileDestroyed(Profile* profile) { | 269 void WakeOnWifiManager::OnProfileDestroyed(Profile* profile) { |
272 connection_observers_.erase(profile); | 270 connection_observers_.erase(profile); |
273 } | 271 } |
274 | 272 |
275 } // namespace chromeos | 273 } // namespace chromeos |
OLD | NEW |