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

Side by Side Diff: components/policy/core/common/policy_loader_mac.mm

Issue 1348903007: Revert of Add source column to chrome://policy showing the origins of policies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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/common/policy_loader_mac.h" 5 #include "components/policy/core/common/policy_loader_mac.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 preferences_->CopyAppValue(name, application_id_)); 79 preferences_->CopyAppValue(name, application_id_));
80 if (!value.get()) 80 if (!value.get())
81 continue; 81 continue;
82 policy_present = true; 82 policy_present = true;
83 bool forced = preferences_->AppValueIsForced(name, application_id_); 83 bool forced = preferences_->AppValueIsForced(name, application_id_);
84 PolicyLevel level = 84 PolicyLevel level =
85 forced ? POLICY_LEVEL_MANDATORY : POLICY_LEVEL_RECOMMENDED; 85 forced ? POLICY_LEVEL_MANDATORY : POLICY_LEVEL_RECOMMENDED;
86 // TODO(joaodasilva): figure the policy scope. 86 // TODO(joaodasilva): figure the policy scope.
87 scoped_ptr<base::Value> policy = PropertyToValue(value); 87 scoped_ptr<base::Value> policy = PropertyToValue(value);
88 if (policy) { 88 if (policy) {
89 chrome_policy.Set(it.key(), level, POLICY_SCOPE_USER, 89 chrome_policy.Set(it.key(), level, POLICY_SCOPE_USER, policy.release(),
90 POLICY_SOURCE_PLATFORM, policy.release(), nullptr); 90 NULL);
91 } else { 91 } else {
92 status.Add(POLICY_LOAD_STATUS_PARSE_ERROR); 92 status.Add(POLICY_LOAD_STATUS_PARSE_ERROR);
93 } 93 }
94 } 94 }
95 95
96 if (!policy_present) 96 if (!policy_present)
97 status.Add(POLICY_LOAD_STATUS_NO_POLICY); 97 status.Add(POLICY_LOAD_STATUS_NO_POLICY);
98 98
99 // Load policy for the registered components. 99 // Load policy for the registered components.
100 LoadPolicyForDomain(POLICY_DOMAIN_EXTENSIONS, "extensions", bundle.get()); 100 LoadPolicyForDomain(POLICY_DOMAIN_EXTENSIONS, "extensions", bundle.get());
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 base::SysUTF8ToCFStringRef(it.key())); 173 base::SysUTF8ToCFStringRef(it.key()));
174 base::ScopedCFTypeRef<CFPropertyListRef> value( 174 base::ScopedCFTypeRef<CFPropertyListRef> value(
175 preferences_->CopyAppValue(pref_name, bundle_id)); 175 preferences_->CopyAppValue(pref_name, bundle_id));
176 if (!value.get()) 176 if (!value.get())
177 continue; 177 continue;
178 bool forced = preferences_->AppValueIsForced(pref_name, bundle_id); 178 bool forced = preferences_->AppValueIsForced(pref_name, bundle_id);
179 PolicyLevel level = 179 PolicyLevel level =
180 forced ? POLICY_LEVEL_MANDATORY : POLICY_LEVEL_RECOMMENDED; 180 forced ? POLICY_LEVEL_MANDATORY : POLICY_LEVEL_RECOMMENDED;
181 scoped_ptr<base::Value> policy_value = PropertyToValue(value); 181 scoped_ptr<base::Value> policy_value = PropertyToValue(value);
182 if (policy_value) { 182 if (policy_value) {
183 policy->Set(it.key(), level, POLICY_SCOPE_USER, POLICY_SOURCE_PLATFORM, 183 policy->Set(it.key(), level, POLICY_SCOPE_USER, policy_value.release(),
184 policy_value.release(), nullptr); 184 NULL);
185 } 185 }
186 } 186 }
187 } 187 }
188 188
189 void PolicyLoaderMac::OnFileUpdated(const base::FilePath& path, bool error) { 189 void PolicyLoaderMac::OnFileUpdated(const base::FilePath& path, bool error) {
190 if (!error) 190 if (!error)
191 Reload(false); 191 Reload(false);
192 } 192 }
193 193
194 } // namespace policy 194 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698