| 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 "chrome/browser/policy/policy_loader_mac.h" | 5 #include "chrome/browser/policy/policy_loader_mac.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 MacPreferences* preferences) | 81 MacPreferences* preferences) |
| 82 : policy_list_(policy_list), | 82 : policy_list_(policy_list), |
| 83 preferences_(preferences), | 83 preferences_(preferences), |
| 84 managed_policy_path_(GetManagedPolicyPath()) {} | 84 managed_policy_path_(GetManagedPolicyPath()) {} |
| 85 | 85 |
| 86 PolicyLoaderMac::~PolicyLoaderMac() {} | 86 PolicyLoaderMac::~PolicyLoaderMac() {} |
| 87 | 87 |
| 88 void PolicyLoaderMac::InitOnFile() { | 88 void PolicyLoaderMac::InitOnFile() { |
| 89 if (!managed_policy_path_.empty()) { | 89 if (!managed_policy_path_.empty()) { |
| 90 watcher_.Watch( | 90 watcher_.Watch( |
| 91 managed_policy_path_, | 91 managed_policy_path_, false, |
| 92 base::Bind(&PolicyLoaderMac::OnFileUpdated, base::Unretained(this))); | 92 base::Bind(&PolicyLoaderMac::OnFileUpdated, base::Unretained(this))); |
| 93 } | 93 } |
| 94 } | 94 } |
| 95 | 95 |
| 96 scoped_ptr<PolicyBundle> PolicyLoaderMac::Load() { | 96 scoped_ptr<PolicyBundle> PolicyLoaderMac::Load() { |
| 97 preferences_->AppSynchronize(kCFPreferencesCurrentApplication); | 97 preferences_->AppSynchronize(kCFPreferencesCurrentApplication); |
| 98 scoped_ptr<PolicyBundle> bundle(new PolicyBundle()); | 98 scoped_ptr<PolicyBundle> bundle(new PolicyBundle()); |
| 99 PolicyMap& chrome_policy = bundle->Get(POLICY_DOMAIN_CHROME, std::string()); | 99 PolicyMap& chrome_policy = bundle->Get(POLICY_DOMAIN_CHROME, std::string()); |
| 100 | 100 |
| 101 const PolicyDefinitionList::Entry* current; | 101 const PolicyDefinitionList::Entry* current; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 | 172 |
| 173 return NULL; | 173 return NULL; |
| 174 } | 174 } |
| 175 | 175 |
| 176 void PolicyLoaderMac::OnFileUpdated(const FilePath& path, bool error) { | 176 void PolicyLoaderMac::OnFileUpdated(const FilePath& path, bool error) { |
| 177 if (!error) | 177 if (!error) |
| 178 Reload(false); | 178 Reload(false); |
| 179 } | 179 } |
| 180 | 180 |
| 181 } // namespace policy | 181 } // namespace policy |
| OLD | NEW |