| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chromeos/network/network_configuration_handler.h" | 5 #include "chromeos/network/network_configuration_handler.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 NET_LOG(USER) << desc << ": " << path + "." + iter.key() + "=" + v; | 72 NET_LOG(USER) << desc << ": " << path + "." + iter.key() + "=" + v; |
| 73 } | 73 } |
| 74 } | 74 } |
| 75 | 75 |
| 76 } // namespace | 76 } // namespace |
| 77 | 77 |
| 78 // Helper class to request from Shill the profile entries associated with a | 78 // Helper class to request from Shill the profile entries associated with a |
| 79 // Service and delete the service from each profile. Triggers either | 79 // Service and delete the service from each profile. Triggers either |
| 80 // |callback| on success or |error_callback| on failure, and calls | 80 // |callback| on success or |error_callback| on failure, and calls |
| 81 // |handler|->ProfileEntryDeleterCompleted() on completion to delete itself. | 81 // |handler|->ProfileEntryDeleterCompleted() on completion to delete itself. |
| 82 class NetworkConfigurationHandler::ProfileEntryDeleter | 82 class NetworkConfigurationHandler::ProfileEntryDeleter { |
| 83 : public base::SupportsWeakPtr<ProfileEntryDeleter> { | |
| 84 public: | 83 public: |
| 85 ProfileEntryDeleter(NetworkConfigurationHandler* handler, | 84 ProfileEntryDeleter(NetworkConfigurationHandler* handler, |
| 86 const std::string& service_path, | 85 const std::string& service_path, |
| 87 const std::string& guid, | 86 const std::string& guid, |
| 88 NetworkConfigurationObserver::Source source, | 87 NetworkConfigurationObserver::Source source, |
| 89 const base::Closure& callback, | 88 const base::Closure& callback, |
| 90 const network_handler::ErrorCallback& error_callback) | 89 const network_handler::ErrorCallback& error_callback) |
| 91 : owner_(handler), | 90 : owner_(handler), |
| 92 service_path_(service_path), | 91 service_path_(service_path), |
| 93 guid_(guid), | 92 guid_(guid), |
| 94 source_(source), | 93 source_(source), |
| 95 callback_(callback), | 94 callback_(callback), |
| 96 error_callback_(error_callback) {} | 95 error_callback_(error_callback), |
| 96 weak_ptr_factory_(this) {} |
| 97 | 97 |
| 98 void Run() { | 98 void Run() { |
| 99 DBusThreadManager::Get() | 99 DBusThreadManager::Get() |
| 100 ->GetShillServiceClient() | 100 ->GetShillServiceClient() |
| 101 ->GetLoadableProfileEntries( | 101 ->GetLoadableProfileEntries( |
| 102 dbus::ObjectPath(service_path_), | 102 dbus::ObjectPath(service_path_), |
| 103 base::Bind(&ProfileEntryDeleter::GetProfileEntriesToDeleteCallback, | 103 base::Bind(&ProfileEntryDeleter::GetProfileEntriesToDeleteCallback, |
| 104 AsWeakPtr())); | 104 weak_ptr_factory_.GetWeakPtr())); |
| 105 } | 105 } |
| 106 | 106 |
| 107 private: | 107 private: |
| 108 void GetProfileEntriesToDeleteCallback( | 108 void GetProfileEntriesToDeleteCallback( |
| 109 DBusMethodCallStatus call_status, | 109 DBusMethodCallStatus call_status, |
| 110 const base::DictionaryValue& profile_entries) { | 110 const base::DictionaryValue& profile_entries) { |
| 111 if (call_status != DBUS_METHOD_CALL_SUCCESS) { | 111 if (call_status != DBUS_METHOD_CALL_SUCCESS) { |
| 112 InvokeErrorCallback(service_path_, error_callback_, | 112 InvokeErrorCallback(service_path_, error_callback_, |
| 113 "GetLoadableProfileEntriesFailed"); | 113 "GetLoadableProfileEntriesFailed"); |
| 114 // ProfileEntryDeleterCompleted will delete this. | 114 // ProfileEntryDeleterCompleted will delete this. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 131 NET_LOG(ERROR) << "Multiple Profile Entries: " << profile_path << ": " | 131 NET_LOG(ERROR) << "Multiple Profile Entries: " << profile_path << ": " |
| 132 << entry_path; | 132 << entry_path; |
| 133 continue; | 133 continue; |
| 134 } | 134 } |
| 135 NET_LOG(DEBUG) << "Delete Profile Entry: " << profile_path << ": " | 135 NET_LOG(DEBUG) << "Delete Profile Entry: " << profile_path << ": " |
| 136 << entry_path; | 136 << entry_path; |
| 137 profile_delete_entries_[profile_path] = entry_path; | 137 profile_delete_entries_[profile_path] = entry_path; |
| 138 DBusThreadManager::Get()->GetShillProfileClient()->DeleteEntry( | 138 DBusThreadManager::Get()->GetShillProfileClient()->DeleteEntry( |
| 139 dbus::ObjectPath(profile_path), entry_path, | 139 dbus::ObjectPath(profile_path), entry_path, |
| 140 base::Bind(&ProfileEntryDeleter::ProfileEntryDeletedCallback, | 140 base::Bind(&ProfileEntryDeleter::ProfileEntryDeletedCallback, |
| 141 AsWeakPtr(), profile_path, entry_path), | 141 weak_ptr_factory_.GetWeakPtr(), profile_path, entry_path), |
| 142 base::Bind(&ProfileEntryDeleter::ShillErrorCallback, AsWeakPtr(), | 142 base::Bind(&ProfileEntryDeleter::ShillErrorCallback, |
| 143 profile_path, entry_path)); | 143 weak_ptr_factory_.GetWeakPtr(), profile_path, entry_path)); |
| 144 } | 144 } |
| 145 } | 145 } |
| 146 | 146 |
| 147 void ProfileEntryDeletedCallback(const std::string& profile_path, | 147 void ProfileEntryDeletedCallback(const std::string& profile_path, |
| 148 const std::string& entry) { | 148 const std::string& entry) { |
| 149 NET_LOG(DEBUG) << "Profile Entry Deleted: " << profile_path << ": " | 149 NET_LOG(DEBUG) << "Profile Entry Deleted: " << profile_path << ": " |
| 150 << entry; | 150 << entry; |
| 151 profile_delete_entries_.erase(profile_path); | 151 profile_delete_entries_.erase(profile_path); |
| 152 if (!profile_delete_entries_.empty()) | 152 if (!profile_delete_entries_.empty()) |
| 153 return; | 153 return; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 176 NetworkConfigurationHandler* owner_; // Unowned | 176 NetworkConfigurationHandler* owner_; // Unowned |
| 177 std::string service_path_; | 177 std::string service_path_; |
| 178 std::string guid_; | 178 std::string guid_; |
| 179 NetworkConfigurationObserver::Source source_; | 179 NetworkConfigurationObserver::Source source_; |
| 180 base::Closure callback_; | 180 base::Closure callback_; |
| 181 network_handler::ErrorCallback error_callback_; | 181 network_handler::ErrorCallback error_callback_; |
| 182 | 182 |
| 183 // Map of pending profile entry deletions, indexed by profile path. | 183 // Map of pending profile entry deletions, indexed by profile path. |
| 184 std::map<std::string, std::string> profile_delete_entries_; | 184 std::map<std::string, std::string> profile_delete_entries_; |
| 185 | 185 |
| 186 base::WeakPtrFactory<ProfileEntryDeleter> weak_ptr_factory_; |
| 187 |
| 186 DISALLOW_COPY_AND_ASSIGN(ProfileEntryDeleter); | 188 DISALLOW_COPY_AND_ASSIGN(ProfileEntryDeleter); |
| 187 }; | 189 }; |
| 188 | 190 |
| 189 // NetworkConfigurationHandler | 191 // NetworkConfigurationHandler |
| 190 | 192 |
| 191 void NetworkConfigurationHandler::AddObserver( | 193 void NetworkConfigurationHandler::AddObserver( |
| 192 NetworkConfigurationObserver* observer) { | 194 NetworkConfigurationObserver* observer) { |
| 193 observers_.AddObserver(observer); | 195 observers_.AddObserver(observer); |
| 194 } | 196 } |
| 195 | 197 |
| 196 void NetworkConfigurationHandler::RemoveObserver( | 198 void NetworkConfigurationHandler::RemoveObserver( |
| 197 NetworkConfigurationObserver* observer) { | 199 NetworkConfigurationObserver* observer) { |
| 198 observers_.RemoveObserver(observer); | 200 observers_.RemoveObserver(observer); |
| 199 } | 201 } |
| 200 | 202 |
| 201 void NetworkConfigurationHandler::GetShillProperties( | 203 void NetworkConfigurationHandler::GetShillProperties( |
| 202 const std::string& service_path, | 204 const std::string& service_path, |
| 203 const network_handler::DictionaryResultCallback& callback, | 205 const network_handler::DictionaryResultCallback& callback, |
| 204 const network_handler::ErrorCallback& error_callback) { | 206 const network_handler::ErrorCallback& error_callback) { |
| 205 NET_LOG(USER) << "GetShillProperties: " << service_path; | 207 NET_LOG(USER) << "GetShillProperties: " << service_path; |
| 206 DBusThreadManager::Get()->GetShillServiceClient()->GetProperties( | 208 DBusThreadManager::Get()->GetShillServiceClient()->GetProperties( |
| 207 dbus::ObjectPath(service_path), | 209 dbus::ObjectPath(service_path), |
| 208 base::Bind(&NetworkConfigurationHandler::GetPropertiesCallback, | 210 base::Bind(&NetworkConfigurationHandler::GetPropertiesCallback, |
| 209 AsWeakPtr(), callback, error_callback, service_path)); | 211 weak_ptr_factory_.GetWeakPtr(), callback, error_callback, |
| 212 service_path)); |
| 210 } | 213 } |
| 211 | 214 |
| 212 void NetworkConfigurationHandler::SetShillProperties( | 215 void NetworkConfigurationHandler::SetShillProperties( |
| 213 const std::string& service_path, | 216 const std::string& service_path, |
| 214 const base::DictionaryValue& shill_properties, | 217 const base::DictionaryValue& shill_properties, |
| 215 NetworkConfigurationObserver::Source source, | 218 NetworkConfigurationObserver::Source source, |
| 216 const base::Closure& callback, | 219 const base::Closure& callback, |
| 217 const network_handler::ErrorCallback& error_callback) { | 220 const network_handler::ErrorCallback& error_callback) { |
| 218 if (shill_properties.empty()) { | 221 if (shill_properties.empty()) { |
| 219 if (!callback.is_null()) | 222 if (!callback.is_null()) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 236 guid); | 239 guid); |
| 237 } | 240 } |
| 238 | 241 |
| 239 LogConfigProperties("SetProperty", service_path, *properties_to_set); | 242 LogConfigProperties("SetProperty", service_path, *properties_to_set); |
| 240 | 243 |
| 241 std::unique_ptr<base::DictionaryValue> properties_copy( | 244 std::unique_ptr<base::DictionaryValue> properties_copy( |
| 242 properties_to_set->DeepCopy()); | 245 properties_to_set->DeepCopy()); |
| 243 DBusThreadManager::Get()->GetShillServiceClient()->SetProperties( | 246 DBusThreadManager::Get()->GetShillServiceClient()->SetProperties( |
| 244 dbus::ObjectPath(service_path), *properties_to_set, | 247 dbus::ObjectPath(service_path), *properties_to_set, |
| 245 base::Bind(&NetworkConfigurationHandler::SetPropertiesSuccessCallback, | 248 base::Bind(&NetworkConfigurationHandler::SetPropertiesSuccessCallback, |
| 246 AsWeakPtr(), service_path, base::Passed(&properties_copy), | 249 weak_ptr_factory_.GetWeakPtr(), service_path, |
| 247 source, callback), | 250 base::Passed(&properties_copy), source, callback), |
| 248 base::Bind(&NetworkConfigurationHandler::SetPropertiesErrorCallback, | 251 base::Bind(&NetworkConfigurationHandler::SetPropertiesErrorCallback, |
| 249 AsWeakPtr(), service_path, error_callback)); | 252 weak_ptr_factory_.GetWeakPtr(), service_path, error_callback)); |
| 250 | 253 |
| 251 // If we set the StaticIPConfig property, request an IP config refresh | 254 // If we set the StaticIPConfig property, request an IP config refresh |
| 252 // after calling SetProperties. | 255 // after calling SetProperties. |
| 253 if (properties_to_set->HasKey(shill::kStaticIPConfigProperty)) | 256 if (properties_to_set->HasKey(shill::kStaticIPConfigProperty)) |
| 254 RequestRefreshIPConfigs(service_path); | 257 RequestRefreshIPConfigs(service_path); |
| 255 } | 258 } |
| 256 | 259 |
| 257 void NetworkConfigurationHandler::ClearShillProperties( | 260 void NetworkConfigurationHandler::ClearShillProperties( |
| 258 const std::string& service_path, | 261 const std::string& service_path, |
| 259 const std::vector<std::string>& names, | 262 const std::vector<std::string>& names, |
| 260 const base::Closure& callback, | 263 const base::Closure& callback, |
| 261 const network_handler::ErrorCallback& error_callback) { | 264 const network_handler::ErrorCallback& error_callback) { |
| 262 if (names.empty()) { | 265 if (names.empty()) { |
| 263 if (!callback.is_null()) | 266 if (!callback.is_null()) |
| 264 callback.Run(); | 267 callback.Run(); |
| 265 return; | 268 return; |
| 266 } | 269 } |
| 267 NET_LOG(USER) << "ClearShillProperties: " << service_path; | 270 NET_LOG(USER) << "ClearShillProperties: " << service_path; |
| 268 for (std::vector<std::string>::const_iterator iter = names.begin(); | 271 for (std::vector<std::string>::const_iterator iter = names.begin(); |
| 269 iter != names.end(); ++iter) { | 272 iter != names.end(); ++iter) { |
| 270 NET_LOG(DEBUG) << "ClearProperty: " << service_path << "." << *iter; | 273 NET_LOG(DEBUG) << "ClearProperty: " << service_path << "." << *iter; |
| 271 } | 274 } |
| 272 DBusThreadManager::Get()->GetShillServiceClient()->ClearProperties( | 275 DBusThreadManager::Get()->GetShillServiceClient()->ClearProperties( |
| 273 dbus::ObjectPath(service_path), names, | 276 dbus::ObjectPath(service_path), names, |
| 274 base::Bind(&NetworkConfigurationHandler::ClearPropertiesSuccessCallback, | 277 base::Bind(&NetworkConfigurationHandler::ClearPropertiesSuccessCallback, |
| 275 AsWeakPtr(), service_path, names, callback), | 278 weak_ptr_factory_.GetWeakPtr(), service_path, names, callback), |
| 276 base::Bind(&NetworkConfigurationHandler::ClearPropertiesErrorCallback, | 279 base::Bind(&NetworkConfigurationHandler::ClearPropertiesErrorCallback, |
| 277 AsWeakPtr(), service_path, error_callback)); | 280 weak_ptr_factory_.GetWeakPtr(), service_path, error_callback)); |
| 278 } | 281 } |
| 279 | 282 |
| 280 void NetworkConfigurationHandler::CreateShillConfiguration( | 283 void NetworkConfigurationHandler::CreateShillConfiguration( |
| 281 const base::DictionaryValue& shill_properties, | 284 const base::DictionaryValue& shill_properties, |
| 282 NetworkConfigurationObserver::Source source, | 285 NetworkConfigurationObserver::Source source, |
| 283 const network_handler::ServiceResultCallback& callback, | 286 const network_handler::ServiceResultCallback& callback, |
| 284 const network_handler::ErrorCallback& error_callback) { | 287 const network_handler::ErrorCallback& error_callback) { |
| 285 ShillManagerClient* manager = | 288 ShillManagerClient* manager = |
| 286 DBusThreadManager::Get()->GetShillManagerClient(); | 289 DBusThreadManager::Get()->GetShillManagerClient(); |
| 287 std::string type; | 290 std::string type; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 315 properties_to_set->SetStringWithoutPathExpansion( | 318 properties_to_set->SetStringWithoutPathExpansion( |
| 316 ::onc::network_config::kGUID, guid); | 319 ::onc::network_config::kGUID, guid); |
| 317 } | 320 } |
| 318 | 321 |
| 319 LogConfigProperties("Configure", type, *properties_to_set); | 322 LogConfigProperties("Configure", type, *properties_to_set); |
| 320 | 323 |
| 321 std::unique_ptr<base::DictionaryValue> properties_copy( | 324 std::unique_ptr<base::DictionaryValue> properties_copy( |
| 322 properties_to_set->DeepCopy()); | 325 properties_to_set->DeepCopy()); |
| 323 manager->ConfigureServiceForProfile( | 326 manager->ConfigureServiceForProfile( |
| 324 dbus::ObjectPath(profile_path), *properties_to_set, | 327 dbus::ObjectPath(profile_path), *properties_to_set, |
| 325 base::Bind(&NetworkConfigurationHandler::RunCreateNetworkCallback, | 328 base::Bind(&NetworkConfigurationHandler::ConfigurationCompleted, |
| 326 AsWeakPtr(), profile_path, source, | 329 weak_ptr_factory_.GetWeakPtr(), profile_path, source, |
| 327 base::Passed(&properties_copy), callback), | 330 base::Passed(&properties_copy), callback), |
| 328 base::Bind(&network_handler::ShillErrorCallbackFunction, | 331 base::Bind(&network_handler::ShillErrorCallbackFunction, |
| 329 "Config.CreateConfiguration Failed", "", error_callback)); | 332 "Config.CreateConfiguration Failed", "", error_callback)); |
| 330 } | 333 } |
| 331 | 334 |
| 332 void NetworkConfigurationHandler::RemoveConfiguration( | 335 void NetworkConfigurationHandler::RemoveConfiguration( |
| 333 const std::string& service_path, | 336 const std::string& service_path, |
| 334 NetworkConfigurationObserver::Source source, | 337 NetworkConfigurationObserver::Source source, |
| 335 const base::Closure& callback, | 338 const base::Closure& callback, |
| 336 const network_handler::ErrorCallback& error_callback) { | 339 const network_handler::ErrorCallback& error_callback) { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 360 NetworkConfigurationObserver::Source source, | 363 NetworkConfigurationObserver::Source source, |
| 361 const base::Closure& callback, | 364 const base::Closure& callback, |
| 362 const network_handler::ErrorCallback& error_callback) { | 365 const network_handler::ErrorCallback& error_callback) { |
| 363 NET_LOG(USER) << "SetNetworkProfile: " << service_path << ": " | 366 NET_LOG(USER) << "SetNetworkProfile: " << service_path << ": " |
| 364 << profile_path; | 367 << profile_path; |
| 365 base::StringValue profile_path_value(profile_path); | 368 base::StringValue profile_path_value(profile_path); |
| 366 DBusThreadManager::Get()->GetShillServiceClient()->SetProperty( | 369 DBusThreadManager::Get()->GetShillServiceClient()->SetProperty( |
| 367 dbus::ObjectPath(service_path), shill::kProfileProperty, | 370 dbus::ObjectPath(service_path), shill::kProfileProperty, |
| 368 profile_path_value, | 371 profile_path_value, |
| 369 base::Bind(&NetworkConfigurationHandler::SetNetworkProfileCompleted, | 372 base::Bind(&NetworkConfigurationHandler::SetNetworkProfileCompleted, |
| 370 AsWeakPtr(), service_path, profile_path, source, callback), | 373 weak_ptr_factory_.GetWeakPtr(), service_path, profile_path, |
| 374 source, callback), |
| 371 base::Bind(&SetNetworkProfileErrorCallback, service_path, profile_path, | 375 base::Bind(&SetNetworkProfileErrorCallback, service_path, profile_path, |
| 372 error_callback)); | 376 error_callback)); |
| 373 } | 377 } |
| 374 | 378 |
| 379 // NetworkStateHandlerObserver methods |
| 380 void NetworkConfigurationHandler::NetworkListChanged() { |
| 381 for (auto iter = configure_callbacks_.begin(); |
| 382 iter != configure_callbacks_.end();) { |
| 383 const std::string& service_path = iter->first; |
| 384 const NetworkState* state = |
| 385 network_state_handler_->GetNetworkStateFromServicePath(service_path, |
| 386 true); |
| 387 if (!state) { |
| 388 NET_LOG(ERROR) << "Configured network not in list: " << service_path; |
| 389 ++iter; |
| 390 continue; |
| 391 } |
| 392 network_handler::ServiceResultCallback& callback = iter->second; |
| 393 callback.Run(service_path, state->guid()); |
| 394 iter = configure_callbacks_.erase(iter); |
| 395 } |
| 396 } |
| 397 |
| 398 void NetworkConfigurationHandler::OnShuttingDown() { |
| 399 network_state_handler_->RemoveObserver(this, FROM_HERE); |
| 400 } |
| 401 |
| 375 // NetworkConfigurationHandler Private methods | 402 // NetworkConfigurationHandler Private methods |
| 376 | 403 |
| 377 NetworkConfigurationHandler::NetworkConfigurationHandler() | 404 NetworkConfigurationHandler::NetworkConfigurationHandler() |
| 378 : network_state_handler_(NULL) { | 405 : network_state_handler_(nullptr), weak_ptr_factory_(this) {} |
| 379 } | |
| 380 | 406 |
| 381 NetworkConfigurationHandler::~NetworkConfigurationHandler() { | 407 NetworkConfigurationHandler::~NetworkConfigurationHandler() { |
| 382 } | 408 } |
| 383 | 409 |
| 384 void NetworkConfigurationHandler::Init( | 410 void NetworkConfigurationHandler::Init( |
| 385 NetworkStateHandler* network_state_handler, | 411 NetworkStateHandler* network_state_handler, |
| 386 NetworkDeviceHandler* network_device_handler) { | 412 NetworkDeviceHandler* network_device_handler) { |
| 387 network_state_handler_ = network_state_handler; | 413 network_state_handler_ = network_state_handler; |
| 388 network_device_handler_ = network_device_handler; | 414 network_device_handler_ = network_device_handler; |
| 415 |
| 416 // Observer is removed in OnShuttingDown() observer override. |
| 417 network_state_handler_->AddObserver(this, FROM_HERE); |
| 389 } | 418 } |
| 390 | 419 |
| 391 void NetworkConfigurationHandler::RunCreateNetworkCallback( | 420 void NetworkConfigurationHandler::ConfigurationCompleted( |
| 392 const std::string& profile_path, | 421 const std::string& profile_path, |
| 393 NetworkConfigurationObserver::Source source, | 422 NetworkConfigurationObserver::Source source, |
| 394 std::unique_ptr<base::DictionaryValue> configure_properties, | 423 std::unique_ptr<base::DictionaryValue> configure_properties, |
| 395 const network_handler::ServiceResultCallback& callback, | 424 const network_handler::ServiceResultCallback& callback, |
| 396 const dbus::ObjectPath& service_path) { | 425 const dbus::ObjectPath& service_path) { |
| 397 if (!callback.is_null()) { | 426 // Shill should send a network list update, but to ensure that Shill sends |
| 398 std::string guid; | 427 // the newly configured properties immediately, request an update here. |
| 399 configure_properties->GetStringWithoutPathExpansion( | 428 network_state_handler_->RequestUpdateForNetwork(service_path.value()); |
| 400 ::onc::network_config::kGUID, &guid); | 429 |
| 401 DCHECK(!guid.empty()); | 430 // Notify observers immediately. (Note: Currently this is primarily used |
| 402 callback.Run(service_path.value(), guid); | 431 // by tests). |
| 403 } | |
| 404 for (auto& observer : observers_) { | 432 for (auto& observer : observers_) { |
| 405 observer.OnConfigurationCreated(service_path.value(), profile_path, | 433 observer.OnConfigurationCreated(service_path.value(), profile_path, |
| 406 *configure_properties, source); | 434 *configure_properties, source); |
| 407 } | 435 } |
| 408 // This may also get called when CreateConfiguration is used to update an | 436 |
| 409 // existing configuration, so request a service update just in case. | 437 if (callback.is_null()) |
| 410 // TODO(pneubeck): Separate 'Create' and 'Update' calls and only trigger | 438 return; |
| 411 // this on an update. | 439 |
| 412 network_state_handler_->RequestUpdateForNetwork(service_path.value()); | 440 // |configure_callbacks_| will get triggered when NetworkStateHandler |
| 441 // notifies this that a state list update has occurred. |service_path| |
| 442 // is unique per configuration. In the unlikely case that an existing |
| 443 // configuration is reconfigured twice without a NetworkStateHandler update, |
| 444 // (the UI should prevent that) the first callback will not get called. |
| 445 configure_callbacks_[service_path.value()] = callback; |
| 413 } | 446 } |
| 414 | 447 |
| 415 void NetworkConfigurationHandler::ProfileEntryDeleterCompleted( | 448 void NetworkConfigurationHandler::ProfileEntryDeleterCompleted( |
| 416 const std::string& service_path, | 449 const std::string& service_path, |
| 417 const std::string& guid, | 450 const std::string& guid, |
| 418 NetworkConfigurationObserver::Source source, | 451 NetworkConfigurationObserver::Source source, |
| 419 bool success) { | 452 bool success) { |
| 420 if (success) { | 453 if (success) { |
| 421 for (auto& observer : observers_) | 454 for (auto& observer : observers_) |
| 422 observer.OnConfigurationRemoved(service_path, guid, source); | 455 observer.OnConfigurationRemoved(service_path, guid, source); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 // static | 593 // static |
| 561 NetworkConfigurationHandler* NetworkConfigurationHandler::InitializeForTest( | 594 NetworkConfigurationHandler* NetworkConfigurationHandler::InitializeForTest( |
| 562 NetworkStateHandler* network_state_handler, | 595 NetworkStateHandler* network_state_handler, |
| 563 NetworkDeviceHandler* network_device_handler) { | 596 NetworkDeviceHandler* network_device_handler) { |
| 564 NetworkConfigurationHandler* handler = new NetworkConfigurationHandler(); | 597 NetworkConfigurationHandler* handler = new NetworkConfigurationHandler(); |
| 565 handler->Init(network_state_handler, network_device_handler); | 598 handler->Init(network_state_handler, network_device_handler); |
| 566 return handler; | 599 return handler; |
| 567 } | 600 } |
| 568 | 601 |
| 569 } // namespace chromeos | 602 } // namespace chromeos |
| OLD | NEW |