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

Side by Side Diff: components/policy/core/browser/configuration_policy_pref_store.cc

Issue 2692203007: Add PrefStore::GetValues (Closed)
Patch Set: Add GetValues to FilesystemJsonPrefStore 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
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 "components/policy/core/browser/configuration_policy_pref_store.h" 5 #include "components/policy/core/browser/configuration_policy_pref_store.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"
11 #include "base/location.h" 11 #include "base/location.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/memory/ptr_util.h"
13 #include "base/single_thread_task_runner.h" 14 #include "base/single_thread_task_runner.h"
14 #include "base/strings/string16.h" 15 #include "base/strings/string16.h"
15 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
16 #include "base/threading/thread_task_runner_handle.h" 17 #include "base/threading/thread_task_runner_handle.h"
17 #include "components/policy/core/browser/configuration_policy_handler_list.h" 18 #include "components/policy/core/browser/configuration_policy_handler_list.h"
18 #include "components/policy/core/browser/policy_error_map.h" 19 #include "components/policy/core/browser/policy_error_map.h"
19 #include "components/prefs/pref_value_map.h" 20 #include "components/prefs/pref_value_map.h"
20 21
21 namespace policy { 22 namespace policy {
22 23
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 const base::Value** value) const { 73 const base::Value** value) const {
73 const base::Value* stored_value = NULL; 74 const base::Value* stored_value = NULL;
74 if (!prefs_.get() || !prefs_->GetValue(key, &stored_value)) 75 if (!prefs_.get() || !prefs_->GetValue(key, &stored_value))
75 return false; 76 return false;
76 77
77 if (value) 78 if (value)
78 *value = stored_value; 79 *value = stored_value;
79 return true; 80 return true;
80 } 81 }
81 82
83 std::unique_ptr<base::DictionaryValue> ConfigurationPolicyPrefStore::GetValues()
84 const {
85 if (!prefs_)
86 return base::MakeUnique<base::DictionaryValue>();
87 return prefs_->AsDictionaryValue();
88 }
89
82 void ConfigurationPolicyPrefStore::OnPolicyUpdated( 90 void ConfigurationPolicyPrefStore::OnPolicyUpdated(
83 const PolicyNamespace& ns, 91 const PolicyNamespace& ns,
84 const PolicyMap& previous, 92 const PolicyMap& previous,
85 const PolicyMap& current) { 93 const PolicyMap& current) {
86 DCHECK_EQ(POLICY_DOMAIN_CHROME, ns.domain); 94 DCHECK_EQ(POLICY_DOMAIN_CHROME, ns.domain);
87 DCHECK(ns.component_id.empty()); 95 DCHECK(ns.component_id.empty());
88 Refresh(); 96 Refresh();
89 } 97 }
90 98
91 void ConfigurationPolicyPrefStore::OnPolicyServiceInitialized( 99 void ConfigurationPolicyPrefStore::OnPolicyServiceInitialized(
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 138
131 // Retrieve and log the errors once the UI loop is ready. This is only an 139 // Retrieve and log the errors once the UI loop is ready. This is only an
132 // issue during startup. 140 // issue during startup.
133 base::ThreadTaskRunnerHandle::Get()->PostTask( 141 base::ThreadTaskRunnerHandle::Get()->PostTask(
134 FROM_HERE, base::Bind(&LogErrors, base::Owned(errors.release()))); 142 FROM_HERE, base::Bind(&LogErrors, base::Owned(errors.release())));
135 143
136 return prefs.release(); 144 return prefs.release();
137 } 145 }
138 146
139 } // namespace policy 147 } // namespace policy
OLDNEW
« no previous file with comments | « components/policy/core/browser/configuration_policy_pref_store.h ('k') | components/prefs/default_pref_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698