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