Chromium Code Reviews| Index: chrome/browser/policy/policy_loader_mac.h |
| diff --git a/chrome/browser/policy/policy_loader_mac.h b/chrome/browser/policy/policy_loader_mac.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b821294d77cf3f796769921d475ed3e271cff8eb |
| --- /dev/null |
| +++ b/chrome/browser/policy/policy_loader_mac.h |
| @@ -0,0 +1,60 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_POLICY_POLICY_LOADER_MAC_H_ |
| +#define CHROME_BROWSER_POLICY_POLICY_LOADER_MAC_H_ |
| +#pragma once |
| + |
| +#include <CoreFoundation/CoreFoundation.h> |
| + |
| +#include "base/file_path.h" |
| +#include "chrome/browser/policy/async_policy_loader.h" |
| +#include "chrome/browser/policy/async_policy_provider.h" |
| + |
| +class MacPreferences; |
| + |
| +namespace base { |
| +class Value; |
| +} // namespace base |
| + |
| +namespace policy { |
| + |
| +struct PolicyDefinitionList; |
| + |
| +// A policy loader that loads policies from the Mac preferences system, and |
| +// watches the managed preferences files for updates. |
| +class MacPolicyLoader : public AsyncPolicyLoader { |
|
Mattias Nissler (ping if slow)
2012/06/04 09:19:02
Shouldn't the class be named PolicyLoaderMac accor
Joao da Silva
2012/06/04 17:55:14
I prefer the name MacPolicyLoader, but the file ha
Mattias Nissler (ping if slow)
2012/06/05 11:55:59
The rest of the code base seems to favor the Mac s
Joao da Silva
2012/06/05 13:52:10
Nice! Renaming done.
|
| + public: |
| + MacPolicyLoader(const PolicyDefinitionList* policy_list, |
| + MacPreferences* preferences); |
| + virtual ~MacPolicyLoader(); |
| + |
| + static AsyncPolicyProvider* CreateProvider( |
| + const PolicyDefinitionList* policy_list); |
| + |
| + // AsyncPolicyLoader implementation. |
| + virtual void InitOnFile() OVERRIDE; |
| + virtual scoped_ptr<PolicyBundle> Load() OVERRIDE; |
| + virtual base::Time LastModificationTime() OVERRIDE; |
| + |
| + // Converts a CFPropertyListRef to the equivalent base::Value. CFDictionary |
| + // entries whose key is not a CFStringRef are ignored. |
| + // The returned value is owned by the caller. |
|
Mattias Nissler (ping if slow)
2012/06/04 09:19:02
return a scoped_ptr then?
Joao da Silva
2012/06/04 17:55:14
This is here just so that unit_tests can exercise
Mattias Nissler (ping if slow)
2012/06/05 11:55:59
OK.
|
| + // Returns NULL if an invalid CFType was found, such as CFDate or CFData. |
| + static base::Value* CreateValueFromProperty(CFPropertyListRef property); |
| + |
| + private: |
| + // List of recognized policies. |
| + const PolicyDefinitionList* policy_list_; |
| + |
| + scoped_ptr<MacPreferences> preferences_; |
| + |
| + FilePath managed_policy_path_; |
|
Mattias Nissler (ping if slow)
2012/06/04 09:19:02
what's this?
Joao da Silva
2012/06/04 17:55:14
Added a comment.
|
| + |
| + DISALLOW_COPY_AND_ASSIGN(MacPolicyLoader); |
| +}; |
| + |
| +} // namespace policy |
| + |
| +#endif // CHROME_BROWSER_POLICY_POLICY_LOADER_MAC_H_ |