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

Side by Side Diff: chrome/browser/chromeos/settings/device_settings_provider.cc

Issue 2602553003: Remove base::ScopedPtrHashMap from components/prefs/. (Closed)
Patch Set: fix Created 3 years, 12 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
« no previous file with comments | « no previous file | chrome/browser/prefs/profile_pref_store_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/browser/chromeos/settings/device_settings_provider.h" 5 #include "chrome/browser/chromeos/settings/device_settings_provider.h"
6 6
7 #include <memory.h> 7 #include <memory.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 DecodeReportingPolicies(settings, &new_values_cache); 728 DecodeReportingPolicies(settings, &new_values_cache);
729 DecodeHeartbeatPolicies(settings, &new_values_cache); 729 DecodeHeartbeatPolicies(settings, &new_values_cache);
730 DecodeGenericPolicies(settings, &new_values_cache); 730 DecodeGenericPolicies(settings, &new_values_cache);
731 DecodeLogUploadPolicies(settings, &new_values_cache); 731 DecodeLogUploadPolicies(settings, &new_values_cache);
732 DecodeDeviceState(policy_data, &new_values_cache); 732 DecodeDeviceState(policy_data, &new_values_cache);
733 733
734 // Collect all notifications but send them only after we have swapped the 734 // Collect all notifications but send them only after we have swapped the
735 // cache so that if somebody actually reads the cache will be already valid. 735 // cache so that if somebody actually reads the cache will be already valid.
736 std::vector<std::string> notifications; 736 std::vector<std::string> notifications;
737 // Go through the new values and verify in the old ones. 737 // Go through the new values and verify in the old ones.
738 PrefValueMap::iterator iter = new_values_cache.begin(); 738 auto iter = new_values_cache.begin();
739 for (; iter != new_values_cache.end(); ++iter) { 739 for (; iter != new_values_cache.end(); ++iter) {
740 const base::Value* old_value; 740 const base::Value* old_value;
741 if (!values_cache_.GetValue(iter->first, &old_value) || 741 if (!values_cache_.GetValue(iter->first, &old_value) ||
742 !old_value->Equals(iter->second)) { 742 !old_value->Equals(iter->second.get())) {
743 notifications.push_back(iter->first); 743 notifications.push_back(iter->first);
744 } 744 }
745 } 745 }
746 // Now check for values that have been removed from the policy blob. 746 // Now check for values that have been removed from the policy blob.
747 for (iter = values_cache_.begin(); iter != values_cache_.end(); ++iter) { 747 for (iter = values_cache_.begin(); iter != values_cache_.end(); ++iter) {
748 const base::Value* value; 748 const base::Value* value;
749 if (!new_values_cache.GetValue(iter->first, &value)) 749 if (!new_values_cache.GetValue(iter->first, &value))
750 notifications.push_back(iter->first); 750 notifications.push_back(iter->first);
751 } 751 }
752 // Swap and notify. 752 // Swap and notify.
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
871 // Notify the observers we are done. 871 // Notify the observers we are done.
872 std::vector<base::Closure> callbacks; 872 std::vector<base::Closure> callbacks;
873 callbacks.swap(callbacks_); 873 callbacks.swap(callbacks_);
874 for (size_t i = 0; i < callbacks.size(); ++i) 874 for (size_t i = 0; i < callbacks.size(); ++i)
875 callbacks[i].Run(); 875 callbacks[i].Run();
876 876
877 return settings_loaded; 877 return settings_loaded;
878 } 878 }
879 879
880 } // namespace chromeos 880 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/prefs/profile_pref_store_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698