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

Side by Side Diff: services/preferences/public/cpp/pref_client_store.cc

Issue 2698913005: Re-enable preferences service access for browser+ash (Closed)
Patch Set: . Created 3 years, 10 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 | « chrome/test/BUILD.gn ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "services/preferences/public/cpp/pref_client_store.h" 5 #include "services/preferences/public/cpp/pref_client_store.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "services/service_manager/public/cpp/connector.h" 9 #include "services/service_manager/public/cpp/connector.h"
10 10
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 } 75 }
76 76
77 PrefClientStore::~PrefClientStore() {} 77 PrefClientStore::~PrefClientStore() {}
78 78
79 void PrefClientStore::SetValueOnPreferenceManager(const std::string& key, 79 void PrefClientStore::SetValueOnPreferenceManager(const std::string& key,
80 const base::Value& value) { 80 const base::Value& value) {
81 if (keys_.find(key) == keys_.end()) 81 if (keys_.find(key) == keys_.end())
82 return; 82 return;
83 83
84 auto prefs = base::MakeUnique<base::DictionaryValue>(); 84 auto prefs = base::MakeUnique<base::DictionaryValue>();
85 prefs->Set(key, value.CreateDeepCopy()); 85 prefs->SetWithoutPathExpansion(key, value.CreateDeepCopy());
86 prefs_service_ptr_->SetPreferences(std::move(prefs)); 86 prefs_service_ptr_->SetPreferences(std::move(prefs));
87 } 87 }
88 88
89 void PrefClientStore::OnPreferencesChanged( 89 void PrefClientStore::OnPreferencesChanged(
90 std::unique_ptr<base::DictionaryValue> preferences) { 90 std::unique_ptr<base::DictionaryValue> preferences) {
91 if (!initialized_) { 91 if (!initialized_) {
92 initialized_ = true; 92 initialized_ = true;
93 NotifyInitializationCompleted(); 93 NotifyInitializationCompleted();
94 } 94 }
95 95
96 for (base::DictionaryValue::Iterator it(*preferences); !it.IsAtEnd(); 96 for (base::DictionaryValue::Iterator it(*preferences); !it.IsAtEnd();
97 it.Advance()) { 97 it.Advance()) {
98 if (keys_.find(it.key()) == keys_.end()) 98 if (keys_.find(it.key()) == keys_.end())
99 continue; 99 continue;
100 ValueMapPrefStore::SetValue(it.key(), it.value().CreateDeepCopy(), 0); 100 ValueMapPrefStore::SetValue(it.key(), it.value().CreateDeepCopy(), 0);
101 } 101 }
102 } 102 }
103 103
104 } // namespace preferences 104 } // namespace preferences
OLDNEW
« no previous file with comments | « chrome/test/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698