Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_POLICY_POLICY_LOADER_MAC_H_ | |
| 6 #define CHROME_BROWSER_POLICY_POLICY_LOADER_MAC_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include <CoreFoundation/CoreFoundation.h> | |
| 10 | |
| 11 #include "base/file_path.h" | |
| 12 #include "chrome/browser/policy/async_policy_loader.h" | |
| 13 #include "chrome/browser/policy/async_policy_provider.h" | |
| 14 | |
| 15 class MacPreferences; | |
| 16 | |
| 17 namespace base { | |
| 18 class Value; | |
| 19 } // namespace base | |
| 20 | |
| 21 namespace policy { | |
| 22 | |
| 23 struct PolicyDefinitionList; | |
| 24 | |
| 25 // A policy loader that loads policies from the Mac preferences system, and | |
| 26 // watches the managed preferences files for updates. | |
| 27 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.
| |
| 28 public: | |
| 29 MacPolicyLoader(const PolicyDefinitionList* policy_list, | |
| 30 MacPreferences* preferences); | |
| 31 virtual ~MacPolicyLoader(); | |
| 32 | |
| 33 static AsyncPolicyProvider* CreateProvider( | |
| 34 const PolicyDefinitionList* policy_list); | |
| 35 | |
| 36 // AsyncPolicyLoader implementation. | |
| 37 virtual void InitOnFile() OVERRIDE; | |
| 38 virtual scoped_ptr<PolicyBundle> Load() OVERRIDE; | |
| 39 virtual base::Time LastModificationTime() OVERRIDE; | |
| 40 | |
| 41 // Converts a CFPropertyListRef to the equivalent base::Value. CFDictionary | |
| 42 // entries whose key is not a CFStringRef are ignored. | |
| 43 // 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.
| |
| 44 // Returns NULL if an invalid CFType was found, such as CFDate or CFData. | |
| 45 static base::Value* CreateValueFromProperty(CFPropertyListRef property); | |
| 46 | |
| 47 private: | |
| 48 // List of recognized policies. | |
| 49 const PolicyDefinitionList* policy_list_; | |
| 50 | |
| 51 scoped_ptr<MacPreferences> preferences_; | |
| 52 | |
| 53 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.
| |
| 54 | |
| 55 DISALLOW_COPY_AND_ASSIGN(MacPolicyLoader); | |
| 56 }; | |
| 57 | |
| 58 } // namespace policy | |
| 59 | |
| 60 #endif // CHROME_BROWSER_POLICY_POLICY_LOADER_MAC_H_ | |
| OLD | NEW |