Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(251)

Side by Side Diff: chromeos/network/managed_network_configuration_handler_impl.cc

Issue 289383004: Merge FavoriteState into NetworkState (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/managed_network_configuration_handler_impl.h" 5 #include "chromeos/network/managed_network_configuration_handler_impl.h"
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/guid.h" 11 #include "base/guid.h"
12 #include "base/location.h" 12 #include "base/location.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/stl_util.h" 16 #include "base/stl_util.h"
17 #include "base/values.h" 17 #include "base/values.h"
18 #include "chromeos/dbus/shill_manager_client.h" 18 #include "chromeos/dbus/shill_manager_client.h"
19 #include "chromeos/dbus/shill_profile_client.h" 19 #include "chromeos/dbus/shill_profile_client.h"
20 #include "chromeos/dbus/shill_service_client.h" 20 #include "chromeos/dbus/shill_service_client.h"
21 #include "chromeos/network/device_state.h" 21 #include "chromeos/network/device_state.h"
22 #include "chromeos/network/favorite_state.h"
23 #include "chromeos/network/network_configuration_handler.h" 22 #include "chromeos/network/network_configuration_handler.h"
24 #include "chromeos/network/network_device_handler.h" 23 #include "chromeos/network/network_device_handler.h"
25 #include "chromeos/network/network_event_log.h" 24 #include "chromeos/network/network_event_log.h"
26 #include "chromeos/network/network_policy_observer.h" 25 #include "chromeos/network/network_policy_observer.h"
27 #include "chromeos/network/network_profile.h" 26 #include "chromeos/network/network_profile.h"
28 #include "chromeos/network/network_profile_handler.h" 27 #include "chromeos/network/network_profile_handler.h"
29 #include "chromeos/network/network_state.h" 28 #include "chromeos/network/network_state.h"
30 #include "chromeos/network/network_state_handler.h" 29 #include "chromeos/network/network_state_handler.h"
31 #include "chromeos/network/network_ui_data.h" 30 #include "chromeos/network/network_ui_data.h"
32 #include "chromeos/network/onc/onc_merger.h" 31 #include "chromeos/network/onc/onc_merger.h"
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 callback.Run(service_path, *onc_network); 234 callback.Run(service_path, *onc_network);
236 } 235 }
237 236
238 // SetProperties 237 // SetProperties
239 238
240 void ManagedNetworkConfigurationHandlerImpl::SetProperties( 239 void ManagedNetworkConfigurationHandlerImpl::SetProperties(
241 const std::string& service_path, 240 const std::string& service_path,
242 const base::DictionaryValue& user_settings, 241 const base::DictionaryValue& user_settings,
243 const base::Closure& callback, 242 const base::Closure& callback,
244 const network_handler::ErrorCallback& error_callback) const { 243 const network_handler::ErrorCallback& error_callback) const {
245 const FavoriteState* state = 244 const NetworkState* state =
246 network_state_handler_->GetFavoriteStateFromServicePath( 245 network_state_handler_->GetNetworkStateFromServicePath(
247 service_path, true /* configured_only */); 246 service_path, true /* configured_only */);
248 if (!state) { 247 if (!state) {
249 InvokeErrorCallback(service_path, error_callback, kUnknownNetwork); 248 InvokeErrorCallback(service_path, error_callback, kUnknownNetwork);
250 return; 249 return;
251 } 250 }
252 251
253 std::string guid = state->guid(); 252 std::string guid = state->guid();
254 if (guid.empty()) { 253 if (guid.empty()) {
255 // TODO(pneubeck): create an initial configuration in this case. As for 254 // TODO(pneubeck): create an initial configuration in this case. As for
256 // CreateConfiguration, user settings from older ChromeOS versions have to 255 // CreateConfiguration, user settings from older ChromeOS versions have to
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 499
501 network_configuration_handler_->CreateConfiguration( 500 network_configuration_handler_->CreateConfiguration(
502 shill_properties, 501 shill_properties,
503 base::Bind( 502 base::Bind(
504 &ManagedNetworkConfigurationHandlerImpl::OnPolicyAppliedToNetwork, 503 &ManagedNetworkConfigurationHandlerImpl::OnPolicyAppliedToNetwork,
505 weak_ptr_factory_.GetWeakPtr()), 504 weak_ptr_factory_.GetWeakPtr()),
506 base::Bind(&LogErrorWithDict, FROM_HERE)); 505 base::Bind(&LogErrorWithDict, FROM_HERE));
507 } 506 }
508 507
509 void ManagedNetworkConfigurationHandlerImpl::OnPoliciesApplied() { 508 void ManagedNetworkConfigurationHandlerImpl::OnPoliciesApplied() {
510 // After all policies were applied, trigger an update of the network lists.
511 if (network_state_handler_)
512 network_state_handler_->UpdateManagerProperties();
513 } 509 }
514 510
515 const base::DictionaryValue* 511 const base::DictionaryValue*
516 ManagedNetworkConfigurationHandlerImpl::FindPolicyByGUID( 512 ManagedNetworkConfigurationHandlerImpl::FindPolicyByGUID(
517 const std::string userhash, 513 const std::string userhash,
518 const std::string& guid, 514 const std::string& guid,
519 ::onc::ONCSource* onc_source) const { 515 ::onc::ONCSource* onc_source) const {
520 *onc_source = ::onc::ONC_SOURCE_NONE; 516 *onc_source = ::onc::ONC_SOURCE_NONE;
521 517
522 if (!userhash.empty()) { 518 if (!userhash.empty()) {
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 scoped_ptr<base::DictionaryValue> network_properties, 715 scoped_ptr<base::DictionaryValue> network_properties,
720 GetDevicePropertiesCallback send_callback, 716 GetDevicePropertiesCallback send_callback,
721 const std::string& error_name, 717 const std::string& error_name,
722 scoped_ptr<base::DictionaryValue> error_data) { 718 scoped_ptr<base::DictionaryValue> error_data) {
723 NET_LOG_ERROR("Error getting device properties", service_path); 719 NET_LOG_ERROR("Error getting device properties", service_path);
724 send_callback.Run(service_path, network_properties.Pass()); 720 send_callback.Run(service_path, network_properties.Pass());
725 } 721 }
726 722
727 723
728 } // namespace chromeos 724 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/favorite_state.cc ('k') | chromeos/network/managed_network_configuration_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698