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

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

Issue 14729017: Add NetworkHandler to own network handlers in src/chromeos/network (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 7 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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.h" 5 #include "chromeos/network/managed_network_configuration_handler.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 const base::DictionaryValue& shill_properties) { 309 const base::DictionaryValue& shill_properties) {
310 scoped_ptr<base::DictionaryValue> onc_network( 310 scoped_ptr<base::DictionaryValue> onc_network(
311 onc::TranslateShillServiceToONCPart( 311 onc::TranslateShillServiceToONCPart(
312 shill_properties, 312 shill_properties,
313 &onc::kNetworkWithStateSignature)); 313 &onc::kNetworkWithStateSignature));
314 callback.Run(service_path, *onc_network); 314 callback.Run(service_path, *onc_network);
315 } 315 }
316 316
317 } // namespace 317 } // namespace
318 318
319 static ManagedNetworkConfigurationHandler*
320 g_configuration_handler_instance = NULL;
321
322 // static
323 void ManagedNetworkConfigurationHandler::Initialize(
324 NetworkProfileHandler* profile_handler) {
325 CHECK(!g_configuration_handler_instance);
326 g_configuration_handler_instance =
327 new ManagedNetworkConfigurationHandler(profile_handler);
328 }
329
330 // static
331 bool ManagedNetworkConfigurationHandler::IsInitialized() {
332 return g_configuration_handler_instance;
333 }
334
335 // static
336 void ManagedNetworkConfigurationHandler::Shutdown() {
337 CHECK(g_configuration_handler_instance);
338 delete g_configuration_handler_instance;
339 g_configuration_handler_instance = NULL;
340 }
341
342 // static
343 ManagedNetworkConfigurationHandler* ManagedNetworkConfigurationHandler::Get() {
344 CHECK(g_configuration_handler_instance);
345 return g_configuration_handler_instance;
346 }
347
348 void ManagedNetworkConfigurationHandler::GetManagedProperties( 319 void ManagedNetworkConfigurationHandler::GetManagedProperties(
349 const std::string& userhash, 320 const std::string& userhash,
350 const std::string& service_path, 321 const std::string& service_path,
351 const network_handler::DictionaryResultCallback& callback, 322 const network_handler::DictionaryResultCallback& callback,
352 const network_handler::ErrorCallback& error_callback) { 323 const network_handler::ErrorCallback& error_callback) {
353 if (!GetPoliciesForUser(userhash) || !GetPoliciesForUser(std::string())) { 324 if (!GetPoliciesForUser(userhash) || !GetPoliciesForUser(std::string())) {
354 RunErrorCallback(service_path, 325 RunErrorCallback(service_path,
355 kPoliciesNotInitialized, 326 kPoliciesNotInitialized,
356 kPoliciesNotInitializedMessage, 327 kPoliciesNotInitializedMessage,
357 error_callback); 328 error_callback);
358 return; 329 return;
359 } 330 }
360 NetworkConfigurationHandler::Get()->GetProperties( 331 NetworkHandler::Get()->network_configuration_handler()->GetProperties(
361 service_path, 332 service_path,
362 base::Bind( 333 base::Bind(
363 &ManagedNetworkConfigurationHandler::GetManagedPropertiesCallback, 334 &ManagedNetworkConfigurationHandler::GetManagedPropertiesCallback,
364 weak_ptr_factory_.GetWeakPtr(), 335 weak_ptr_factory_.GetWeakPtr(),
365 callback, 336 callback,
366 error_callback), 337 error_callback),
367 error_callback); 338 error_callback);
368 } 339 }
369 340
370 void ManagedNetworkConfigurationHandler::GetManagedPropertiesCallback( 341 void ManagedNetworkConfigurationHandler::GetManagedPropertiesCallback(
371 const network_handler::DictionaryResultCallback& callback, 342 const network_handler::DictionaryResultCallback& callback,
372 const network_handler::ErrorCallback& error_callback, 343 const network_handler::ErrorCallback& error_callback,
373 const std::string& service_path, 344 const std::string& service_path,
374 const base::DictionaryValue& shill_properties) { 345 const base::DictionaryValue& shill_properties) {
375 std::string profile_path; 346 std::string profile_path;
376 shill_properties.GetStringWithoutPathExpansion(flimflam::kProfileProperty, 347 shill_properties.GetStringWithoutPathExpansion(flimflam::kProfileProperty,
377 &profile_path); 348 &profile_path);
378 const NetworkProfile* profile = 349 const NetworkProfile* profile = NetworkHandler::Get()->
379 profile_handler_->GetProfileForPath(profile_path); 350 network_profile_handler()->GetProfileForPath(profile_path);
380 if (!profile) { 351 if (!profile) {
381 VLOG(1) << "No or no known profile received for service " 352 VLOG(1) << "No or no known profile received for service "
382 << service_path << "."; 353 << service_path << ".";
383 } 354 }
384 355
385 scoped_ptr<NetworkUIData> ui_data = GetUIData(shill_properties); 356 scoped_ptr<NetworkUIData> ui_data = GetUIData(shill_properties);
386 357
387 const base::DictionaryValue* user_settings = NULL; 358 const base::DictionaryValue* user_settings = NULL;
388 const base::DictionaryValue* shared_settings = NULL; 359 const base::DictionaryValue* shared_settings = NULL;
389 360
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 user_settings, 411 user_settings,
441 shared_settings, 412 shared_settings,
442 active_settings.get()); 413 active_settings.get());
443 callback.Run(service_path, *augmented_properties); 414 callback.Run(service_path, *augmented_properties);
444 } 415 }
445 416
446 void ManagedNetworkConfigurationHandler::GetProperties( 417 void ManagedNetworkConfigurationHandler::GetProperties(
447 const std::string& service_path, 418 const std::string& service_path,
448 const network_handler::DictionaryResultCallback& callback, 419 const network_handler::DictionaryResultCallback& callback,
449 const network_handler::ErrorCallback& error_callback) const { 420 const network_handler::ErrorCallback& error_callback) const {
450 NetworkConfigurationHandler::Get()->GetProperties( 421 NetworkHandler::Get()->network_configuration_handler()->GetProperties(
451 service_path, 422 service_path,
452 base::Bind(&TranslatePropertiesToOncAndRunCallback, callback), 423 base::Bind(&TranslatePropertiesToOncAndRunCallback, callback),
453 error_callback); 424 error_callback);
454 } 425 }
455 426
456 void ManagedNetworkConfigurationHandler::SetProperties( 427 void ManagedNetworkConfigurationHandler::SetProperties(
457 const std::string& service_path, 428 const std::string& service_path,
458 const base::DictionaryValue& user_settings, 429 const base::DictionaryValue& user_settings,
459 const base::Closure& callback, 430 const base::Closure& callback,
460 const network_handler::ErrorCallback& error_callback) const { 431 const network_handler::ErrorCallback& error_callback) const {
461 const NetworkState* state = 432 const NetworkState* state = NetworkHandler::Get()->network_state_handler()->
462 NetworkStateHandler::Get()->GetNetworkState(service_path); 433 GetNetworkState(service_path);
463 434
464 if (!state) { 435 if (!state) {
465 RunErrorCallback(service_path, 436 RunErrorCallback(service_path,
466 kUnknownServicePath, 437 kUnknownServicePath,
467 kUnknownServicePathMessage, 438 kUnknownServicePathMessage,
468 error_callback); 439 error_callback);
469 return; 440 return;
470 } 441 }
471 442
472 std::string guid = state->guid(); 443 std::string guid = state->guid();
473 if (guid.empty()) { 444 if (guid.empty()) {
474 // TODO(pneubeck): create an initial configuration in this case. As for 445 // TODO(pneubeck): create an initial configuration in this case. As for
475 // CreateConfiguration, user settings from older ChromeOS versions have to 446 // CreateConfiguration, user settings from older ChromeOS versions have to
476 // determined here. 447 // determined here.
477 RunErrorCallback(service_path, 448 RunErrorCallback(service_path,
478 kSetOnUnconfiguredNetwork, 449 kSetOnUnconfiguredNetwork,
479 kSetOnUnconfiguredNetworkMessage, 450 kSetOnUnconfiguredNetworkMessage,
480 error_callback); 451 error_callback);
481 return; 452 return;
482 } 453 }
483 454
484 const std::string& profile_path = state->profile_path(); 455 const std::string& profile_path = state->profile_path();
485 const NetworkProfile *profile = 456 const NetworkProfile *profile = NetworkHandler::Get()->
486 profile_handler_->GetProfileForPath(profile_path); 457 network_profile_handler()->GetProfileForPath(profile_path);
487 if (!profile) { 458 if (!profile) {
488 RunErrorCallback(service_path, 459 RunErrorCallback(service_path,
489 kUnknownProfilePath, 460 kUnknownProfilePath,
490 kUnknownProfilePathMessage, 461 kUnknownProfilePathMessage,
491 error_callback); 462 error_callback);
492 return; 463 return;
493 } 464 }
494 465
495 VLOG(2) << "SetProperties: Found GUID " << guid << " and profile " 466 VLOG(2) << "SetProperties: Found GUID " << guid << " and profile "
496 << profile->ToDebugString(); 467 << profile->ToDebugString();
(...skipping 30 matching lines...) Expand all
527 } 498 }
528 if (validation_result == onc::Validator::VALID_WITH_WARNINGS) 499 if (validation_result == onc::Validator::VALID_WITH_WARNINGS)
529 LOG(WARNING) << "Validation of ONC user settings produced warnings."; 500 LOG(WARNING) << "Validation of ONC user settings produced warnings.";
530 501
531 const base::DictionaryValue* policy = GetByGUID(*policies, guid); 502 const base::DictionaryValue* policy = GetByGUID(*policies, guid);
532 VLOG(2) << "This configuration is " << (policy ? "" : "not ") << "managed."; 503 VLOG(2) << "This configuration is " << (policy ? "" : "not ") << "managed.";
533 504
534 scoped_ptr<base::DictionaryValue> shill_dictionary( 505 scoped_ptr<base::DictionaryValue> shill_dictionary(
535 CreateShillConfiguration(*profile, guid, policy, &user_settings)); 506 CreateShillConfiguration(*profile, guid, policy, &user_settings));
536 507
537 NetworkConfigurationHandler::Get()->SetProperties(service_path, 508 NetworkHandler::Get()->network_configuration_handler()->SetProperties(
538 *shill_dictionary, 509 service_path, *shill_dictionary, callback, error_callback);
539 callback,
540 error_callback);
541 } 510 }
542 511
543 void ManagedNetworkConfigurationHandler::Connect( 512 void ManagedNetworkConfigurationHandler::Connect(
544 const std::string& service_path, 513 const std::string& service_path,
545 const base::Closure& callback, 514 const base::Closure& callback,
546 const network_handler::ErrorCallback& error_callback) const { 515 const network_handler::ErrorCallback& error_callback) const {
547 NetworkConfigurationHandler::Get()->Connect(service_path, 516 NetworkHandler::Get()->network_configuration_handler()->Connect(
548 callback, 517 service_path, callback, error_callback);
549 error_callback);
550 } 518 }
551 519
552 void ManagedNetworkConfigurationHandler::Disconnect( 520 void ManagedNetworkConfigurationHandler::Disconnect(
553 const std::string& service_path, 521 const std::string& service_path,
554 const base::Closure& callback, 522 const base::Closure& callback,
555 const network_handler::ErrorCallback& error_callback) const { 523 const network_handler::ErrorCallback& error_callback) const {
556 NetworkConfigurationHandler::Get()->Disconnect(service_path, 524 NetworkHandler::Get()->network_configuration_handler()->Disconnect(
557 callback, 525 service_path, callback, error_callback);
558 error_callback);
559 } 526 }
560 527
561 void ManagedNetworkConfigurationHandler::CreateConfiguration( 528 void ManagedNetworkConfigurationHandler::CreateConfiguration(
562 const std::string& userhash, 529 const std::string& userhash,
563 const base::DictionaryValue& properties, 530 const base::DictionaryValue& properties,
564 const network_handler::StringResultCallback& callback, 531 const network_handler::StringResultCallback& callback,
565 const network_handler::ErrorCallback& error_callback) const { 532 const network_handler::ErrorCallback& error_callback) const {
566 const GuidToPolicyMap* policies = GetPoliciesForUser(userhash); 533 const GuidToPolicyMap* policies = GetPoliciesForUser(userhash);
567 if (!policies) { 534 if (!policies) {
568 RunErrorCallback("", 535 RunErrorCallback("",
569 kPoliciesNotInitialized, 536 kPoliciesNotInitialized,
570 kPoliciesNotInitializedMessage, 537 kPoliciesNotInitializedMessage,
571 error_callback); 538 error_callback);
572 return; 539 return;
573 } 540 }
574 541
575 if (FindMatchingPolicy(*policies, properties)) { 542 if (FindMatchingPolicy(*policies, properties)) {
576 RunErrorCallback("", 543 RunErrorCallback("",
577 kNetworkAlreadyConfigured, 544 kNetworkAlreadyConfigured,
578 kNetworkAlreadyConfiguredMessage, 545 kNetworkAlreadyConfiguredMessage,
579 error_callback); 546 error_callback);
580 } 547 }
581 548
582 const NetworkProfile* profile = 549 const NetworkProfile* profile = NetworkHandler::Get()->
583 profile_handler_->GetProfileForUserhash(userhash); 550 network_profile_handler()->GetProfileForUserhash(userhash);
584 if (!profile) { 551 if (!profile) {
585 RunErrorCallback("", 552 RunErrorCallback("",
586 kProfileNotInitialized, 553 kProfileNotInitialized,
587 kProfileNotInitializedMessage, 554 kProfileNotInitializedMessage,
588 error_callback); 555 error_callback);
589 } 556 }
590 557
591 // TODO(pneubeck): In case of WiFi, check that no other configuration for the 558 // TODO(pneubeck): In case of WiFi, check that no other configuration for the
592 // same {SSID, mode, security} exists. We don't support such multiple 559 // same {SSID, mode, security} exists. We don't support such multiple
593 // configurations, yet. 560 // configurations, yet.
594 561
595 // Generate a new GUID for this configuration. Ignore the maybe provided GUID 562 // Generate a new GUID for this configuration. Ignore the maybe provided GUID
596 // in |properties| as it is not our own and from an untrusted source. 563 // in |properties| as it is not our own and from an untrusted source.
597 std::string guid = base::GenerateGUID(); 564 std::string guid = base::GenerateGUID();
598 scoped_ptr<base::DictionaryValue> shill_dictionary( 565 scoped_ptr<base::DictionaryValue> shill_dictionary(
599 CreateShillConfiguration(*profile, guid, NULL /*no policy*/, 566 CreateShillConfiguration(*profile, guid, NULL /*no policy*/,
600 &properties)); 567 &properties));
601 568
602 NetworkConfigurationHandler::Get()->CreateConfiguration(*shill_dictionary, 569 NetworkHandler::Get()->network_configuration_handler()->CreateConfiguration(
603 callback, 570 *shill_dictionary, callback, error_callback);
604 error_callback);
605 } 571 }
606 572
607 void ManagedNetworkConfigurationHandler::RemoveConfiguration( 573 void ManagedNetworkConfigurationHandler::RemoveConfiguration(
608 const std::string& service_path, 574 const std::string& service_path,
609 const base::Closure& callback, 575 const base::Closure& callback,
610 const network_handler::ErrorCallback& error_callback) const { 576 const network_handler::ErrorCallback& error_callback) const {
611 NetworkConfigurationHandler::Get()->RemoveConfiguration(service_path, 577 NetworkHandler::Get()->network_configuration_handler()->RemoveConfiguration(
612 callback, 578 service_path, callback, error_callback);
613 error_callback);
614 } 579 }
615 580
616 // This class compares (entry point is Run()) |modified_policies| with the 581 // This class compares (entry point is Run()) |modified_policies| with the
617 // existing entries in the provided Shill profile |profile|. It fetches all 582 // existing entries in the provided Shill profile |profile|. It fetches all
618 // entries in parallel (GetProfileProperties), compares each entry with the 583 // entries in parallel (GetProfileProperties), compares each entry with the
619 // current policies (GetEntry) and adds all missing policies 584 // current policies (GetEntry) and adds all missing policies
620 // (~PolicyApplicator). 585 // (~PolicyApplicator).
621 class ManagedNetworkConfigurationHandler::PolicyApplicator 586 class ManagedNetworkConfigurationHandler::PolicyApplicator
622 : public base::RefCounted<PolicyApplicator> { 587 : public base::RefCounted<PolicyApplicator> {
623 public: 588 public:
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 } else { 715 } else {
751 VLOG_IF(1, old_guid == new_guid) 716 VLOG_IF(1, old_guid == new_guid)
752 << "Updating previously managed configuration with the updated " 717 << "Updating previously managed configuration with the updated "
753 << "policy " << new_guid << "."; 718 << "policy " << new_guid << ".";
754 719
755 // Update the existing configuration with the maybe changed 720 // Update the existing configuration with the maybe changed
756 // policy. Thereby the GUID might change. 721 // policy. Thereby the GUID might change.
757 scoped_ptr<base::DictionaryValue> shill_dictionary = 722 scoped_ptr<base::DictionaryValue> shill_dictionary =
758 CreateShillConfiguration(profile_, new_guid, new_policy, 723 CreateShillConfiguration(profile_, new_guid, new_policy,
759 ui_data->user_settings()); 724 ui_data->user_settings());
760 NetworkConfigurationHandler::Get()->CreateConfiguration( 725 NetworkHandler::Get()->network_configuration_handler()->
761 *shill_dictionary, 726 CreateConfiguration(*shill_dictionary,
762 base::Bind(&IgnoreString), 727 base::Bind(&IgnoreString),
763 base::Bind(&LogErrorWithDict, FROM_HERE)); 728 base::Bind(&LogErrorWithDict, FROM_HERE));
764 remaining_policies_.erase(new_guid); 729 remaining_policies_.erase(new_guid);
765 } 730 }
766 } else if (was_managed) { 731 } else if (was_managed) {
767 VLOG(1) << "Removing configuration previously managed by policy " 732 VLOG(1) << "Removing configuration previously managed by policy "
768 << old_guid << ", because the policy was removed."; 733 << old_guid << ", because the policy was removed.";
769 734
770 // Remove the entry, because the network was managed but isn't anymore. 735 // Remove the entry, because the network was managed but isn't anymore.
771 // Note: An alternative might be to preserve the user settings, but it's 736 // Note: An alternative might be to preserve the user settings, but it's
772 // unclear which values originating the policy should be removed. 737 // unclear which values originating the policy should be removed.
773 DeleteEntry(entry); 738 DeleteEntry(entry);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 LOG(ERROR) << "Policy " << *it << " doesn't exist anymore."; 780 LOG(ERROR) << "Policy " << *it << " doesn't exist anymore.";
816 continue; 781 continue;
817 } 782 }
818 783
819 VLOG(1) << "Creating new configuration managed by policy " << *it 784 VLOG(1) << "Creating new configuration managed by policy " << *it
820 << " in profile " << profile_.ToDebugString() << "."; 785 << " in profile " << profile_.ToDebugString() << ".";
821 786
822 scoped_ptr<base::DictionaryValue> shill_dictionary = 787 scoped_ptr<base::DictionaryValue> shill_dictionary =
823 CreateShillConfiguration(profile_, *it, policy, 788 CreateShillConfiguration(profile_, *it, policy,
824 NULL /* no user settings */); 789 NULL /* no user settings */);
825 NetworkConfigurationHandler::Get()->CreateConfiguration( 790 NetworkHandler::Get()->network_configuration_handler()->
826 *shill_dictionary, 791 CreateConfiguration(*shill_dictionary,
827 base::Bind(&IgnoreString), 792 base::Bind(&IgnoreString),
828 base::Bind(&LogErrorWithDict, FROM_HERE)); 793 base::Bind(&LogErrorWithDict, FROM_HERE));
829 } 794 }
830 } 795 }
831 796
832 std::set<std::string> remaining_policies_; 797 std::set<std::string> remaining_policies_;
833 base::WeakPtr<ManagedNetworkConfigurationHandler> handler_; 798 base::WeakPtr<ManagedNetworkConfigurationHandler> handler_;
834 NetworkProfile profile_; 799 NetworkProfile profile_;
835 800
836 DISALLOW_COPY_AND_ASSIGN(PolicyApplicator); 801 DISALLOW_COPY_AND_ASSIGN(PolicyApplicator);
837 }; 802 };
838 803
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 const base::DictionaryValue* new_entry = network->DeepCopy(); 838 const base::DictionaryValue* new_entry = network->DeepCopy();
874 policies[guid] = new_entry; 839 policies[guid] = new_entry;
875 840
876 const base::DictionaryValue* old_entry = old_policies[guid]; 841 const base::DictionaryValue* old_entry = old_policies[guid];
877 if (!old_entry || !old_entry->Equals(new_entry)) 842 if (!old_entry || !old_entry->Equals(new_entry))
878 modified_policies.insert(guid); 843 modified_policies.insert(guid);
879 } 844 }
880 845
881 STLDeleteValues(&old_policies); 846 STLDeleteValues(&old_policies);
882 847
883 const NetworkProfile* profile = 848 const NetworkProfile* profile = NetworkHandler::Get()->
884 profile_handler_->GetProfileForUserhash(userhash); 849 network_profile_handler()->GetProfileForUserhash(userhash);
885 if (!profile) { 850 if (!profile) {
886 VLOG(1) << "The relevant Shill profile isn't initialized yet, postponing " 851 VLOG(1) << "The relevant Shill profile isn't initialized yet, postponing "
887 << "policy application."; 852 << "policy application.";
888 return; 853 return;
889 } 854 }
890 855
891 scoped_refptr<PolicyApplicator> applicator = new PolicyApplicator( 856 scoped_refptr<PolicyApplicator> applicator = new PolicyApplicator(
892 weak_ptr_factory_.GetWeakPtr(), 857 weak_ptr_factory_.GetWeakPtr(),
893 *profile, 858 *profile,
894 &modified_policies); 859 &modified_policies);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 } 899 }
935 900
936 const ManagedNetworkConfigurationHandler::GuidToPolicyMap* 901 const ManagedNetworkConfigurationHandler::GuidToPolicyMap*
937 ManagedNetworkConfigurationHandler::GetPoliciesForProfile( 902 ManagedNetworkConfigurationHandler::GetPoliciesForProfile(
938 const NetworkProfile& profile) const { 903 const NetworkProfile& profile) const {
939 DCHECK(profile.type() != NetworkProfile::TYPE_SHARED || 904 DCHECK(profile.type() != NetworkProfile::TYPE_SHARED ||
940 profile.userhash.empty()); 905 profile.userhash.empty());
941 return GetPoliciesForUser(profile.userhash); 906 return GetPoliciesForUser(profile.userhash);
942 } 907 }
943 908
944 ManagedNetworkConfigurationHandler::ManagedNetworkConfigurationHandler( 909 ManagedNetworkConfigurationHandler::ManagedNetworkConfigurationHandler()
945 NetworkProfileHandler* profile_handler) 910 : weak_ptr_factory_(this) {
946 : profile_handler_(profile_handler),
947 weak_ptr_factory_(this) {
948 profile_handler_->AddObserver(this);
949 } 911 }
950 912
951 ManagedNetworkConfigurationHandler::~ManagedNetworkConfigurationHandler() { 913 ManagedNetworkConfigurationHandler::~ManagedNetworkConfigurationHandler() {
952 profile_handler_->RemoveObserver(this); 914 NetworkHandler::Get()->network_profile_handler()->RemoveObserver(this);
953 for (UserToPoliciesMap::iterator it = policies_by_user_.begin(); 915 for (UserToPoliciesMap::iterator it = policies_by_user_.begin();
954 it != policies_by_user_.end(); ++it) { 916 it != policies_by_user_.end(); ++it) {
955 STLDeleteValues(&it->second); 917 STLDeleteValues(&it->second);
956 } 918 }
957 } 919 }
958 920
921 void ManagedNetworkConfigurationHandler::Init() {
922 NetworkHandler::Get()->network_profile_handler()->AddObserver(this);
923 }
924
959 } // namespace chromeos 925 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698