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

Side by Side Diff: chrome/browser/extensions/api/storage/policy_value_store.cc

Issue 2811673002: Reland: Stop passing raw pointers to base::Value API in c/b/chromeos and c/b/extensions (Closed)
Patch Set: Workaround with std::move Created 3 years, 8 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
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/extensions/api/storage/policy_value_store.h" 5 #include "chrome/browser/extensions/api/storage/policy_value_store.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 28 matching lines...) Expand all
39 39
40 void PolicyValueStore::SetCurrentPolicy(const policy::PolicyMap& policy) { 40 void PolicyValueStore::SetCurrentPolicy(const policy::PolicyMap& policy) {
41 DCHECK_CURRENTLY_ON(BrowserThread::FILE); 41 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
42 // Convert |policy| to a dictionary value. Only include mandatory policies 42 // Convert |policy| to a dictionary value. Only include mandatory policies
43 // for now. 43 // for now.
44 base::DictionaryValue current_policy; 44 base::DictionaryValue current_policy;
45 for (policy::PolicyMap::const_iterator it = policy.begin(); 45 for (policy::PolicyMap::const_iterator it = policy.begin();
46 it != policy.end(); ++it) { 46 it != policy.end(); ++it) {
47 if (it->second.level == policy::POLICY_LEVEL_MANDATORY) { 47 if (it->second.level == policy::POLICY_LEVEL_MANDATORY) {
48 current_policy.SetWithoutPathExpansion( 48 current_policy.SetWithoutPathExpansion(
49 it->first, it->second.value->DeepCopy()); 49 it->first, it->second.value->CreateDeepCopy());
50 } 50 }
51 } 51 }
52 52
53 // Get the previous policies stored in the database. 53 // Get the previous policies stored in the database.
54 // TODO(joaodasilva): it'd be better to have a less expensive way of 54 // TODO(joaodasilva): it'd be better to have a less expensive way of
55 // determining which keys are currently stored, or of determining which keys 55 // determining which keys are currently stored, or of determining which keys
56 // must be removed. 56 // must be removed.
57 base::DictionaryValue previous_policy; 57 base::DictionaryValue previous_policy;
58 ValueStore::ReadResult read_result = delegate_->Get(); 58 ValueStore::ReadResult read_result = delegate_->Get();
59 59
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 ValueStore::WriteResult PolicyValueStore::Remove( 153 ValueStore::WriteResult PolicyValueStore::Remove(
154 const std::vector<std::string>& keys) { 154 const std::vector<std::string>& keys) {
155 return MakeWriteResult(ReadOnlyError()); 155 return MakeWriteResult(ReadOnlyError());
156 } 156 }
157 157
158 ValueStore::WriteResult PolicyValueStore::Clear() { 158 ValueStore::WriteResult PolicyValueStore::Clear() {
159 return MakeWriteResult(ReadOnlyError()); 159 return MakeWriteResult(ReadOnlyError());
160 } 160 }
161 161
162 } // namespace extensions 162 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698