| OLD | NEW |
| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 } | 63 } |
| 64 | 64 |
| 65 std::unique_ptr<PolicyBundle> PolicyLoaderMac::Load() { | 65 std::unique_ptr<PolicyBundle> PolicyLoaderMac::Load() { |
| 66 preferences_->AppSynchronize(application_id_); | 66 preferences_->AppSynchronize(application_id_); |
| 67 std::unique_ptr<PolicyBundle> bundle(new PolicyBundle()); | 67 std::unique_ptr<PolicyBundle> bundle(new PolicyBundle()); |
| 68 | 68 |
| 69 // Load Chrome's policy. | 69 // Load Chrome's policy. |
| 70 PolicyMap& chrome_policy = | 70 PolicyMap& chrome_policy = |
| 71 bundle->Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())); | 71 bundle->Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())); |
| 72 | 72 |
| 73 PolicyLoadStatusSample status; | 73 PolicyLoadStatusUmaReporter status; |
| 74 bool policy_present = false; | 74 bool policy_present = false; |
| 75 const Schema* schema = | 75 const Schema* schema = |
| 76 schema_map()->GetSchema(PolicyNamespace(POLICY_DOMAIN_CHROME, "")); | 76 schema_map()->GetSchema(PolicyNamespace(POLICY_DOMAIN_CHROME, "")); |
| 77 for (Schema::Iterator it = schema->GetPropertiesIterator(); !it.IsAtEnd(); | 77 for (Schema::Iterator it = schema->GetPropertiesIterator(); !it.IsAtEnd(); |
| 78 it.Advance()) { | 78 it.Advance()) { |
| 79 base::ScopedCFTypeRef<CFStringRef> name( | 79 base::ScopedCFTypeRef<CFStringRef> name( |
| 80 base::SysUTF8ToCFStringRef(it.key())); | 80 base::SysUTF8ToCFStringRef(it.key())); |
| 81 base::ScopedCFTypeRef<CFPropertyListRef> value( | 81 base::ScopedCFTypeRef<CFPropertyListRef> value( |
| 82 preferences_->CopyAppValue(name, application_id_)); | 82 preferences_->CopyAppValue(name, application_id_)); |
| 83 if (!value) | 83 if (!value) |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 } | 188 } |
| 189 } | 189 } |
| 190 } | 190 } |
| 191 | 191 |
| 192 void PolicyLoaderMac::OnFileUpdated(const base::FilePath& path, bool error) { | 192 void PolicyLoaderMac::OnFileUpdated(const base::FilePath& path, bool error) { |
| 193 if (!error) | 193 if (!error) |
| 194 Reload(false); | 194 Reload(false); |
| 195 } | 195 } |
| 196 | 196 |
| 197 } // namespace policy | 197 } // namespace policy |
| OLD | NEW |