summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authormnissler@chromium.org <mnissler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-29 13:09:55 +0000
committermnissler@chromium.org <mnissler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-29 13:09:55 +0000
commit7c5972380d2432472b0bfe25fbd07db134731007 (patch)
tree06c7114340907eeb3abf5dc72053090c7160b95f /base
parent8127442bb787fcdfe6af0c40131d11103072af17 (diff)
downloadchromium_src-7c5972380d2432472b0bfe25fbd07db134731007.zip
chromium_src-7c5972380d2432472b0bfe25fbd07db134731007.tar.gz
chromium_src-7c5972380d2432472b0bfe25fbd07db134731007.tar.bz2
Dynamic policy refresh support for the Mac.
Adapt the file watching code we already had for ConfigDirPolicyProvider to support a loader delegate, make the old code use it and change the Mac policy provider to watch for changes to the plist file in /Library/Managed Preferences/<username>. BUG=52040 TEST=unit tests Review URL: http://codereview.chromium.org/4062002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64415 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/mac_util.h14
-rw-r--r--base/mac_util.mm14
2 files changed, 26 insertions, 2 deletions
diff --git a/base/mac_util.h b/base/mac_util.h
index e590d30..182fcc8 100644
--- a/base/mac_util.h
+++ b/base/mac_util.h
@@ -24,8 +24,10 @@ class NSWindow;
// Adapted from NSPathUtilities.h and NSObjCRuntime.h.
#if __LP64__ || NS_BUILD_32_LIKE_64
typedef unsigned long NSSearchPathDirectory;
+typedef unsigned long NSSearchPathDomainMask;
#else
typedef unsigned int NSSearchPathDirectory;
+typedef unsigned int NSSearchPathDomainMask;
#endif
namespace mac_util {
@@ -74,11 +76,23 @@ OSType CreatorCodeForCFBundleRef(CFBundleRef bundle);
// app bundle's creator code anyway.
OSType CreatorCodeForApplication();
+// Searches for directories for the given key in only the given |domain_mask|.
+// If found, fills result (which must always be non-NULL) with the
+// first found directory and returns true. Otherwise, returns false.
+bool GetSearchPathDirectory(NSSearchPathDirectory directory,
+ NSSearchPathDomainMask domain_mask,
+ FilePath* result);
+
// Searches for directories for the given key in only the user domain.
// If found, fills result (which must always be non-NULL) with the
// first found directory and returns true. Otherwise, returns false.
bool GetUserDirectory(NSSearchPathDirectory directory, FilePath* result);
+// Searches for directories for the given key in only the local domain.
+// If found, fills result (which must always be non-NULL) with the
+// first found directory and returns true. Otherwise, returns false.
+bool GetLocalDirectory(NSSearchPathDirectory directory, FilePath* result);
+
// Returns the ~/Library directory.
FilePath GetUserLibraryPath();
diff --git a/base/mac_util.mm b/base/mac_util.mm
index f4e988a..4e6b105 100644
--- a/base/mac_util.mm
+++ b/base/mac_util.mm
@@ -219,10 +219,12 @@ OSType CreatorCodeForApplication() {
return CreatorCodeForCFBundleRef(bundle);
}
-bool GetUserDirectory(NSSearchPathDirectory directory, FilePath* result) {
+bool GetSearchPathDirectory(NSSearchPathDirectory directory,
+ NSSearchPathDomainMask domain_mask,
+ FilePath* result) {
DCHECK(result);
NSArray* dirs =
- NSSearchPathForDirectoriesInDomains(directory, NSUserDomainMask, YES);
+ NSSearchPathForDirectoriesInDomains(directory, domain_mask, YES);
if ([dirs count] < 1) {
return false;
}
@@ -231,6 +233,14 @@ bool GetUserDirectory(NSSearchPathDirectory directory, FilePath* result) {
return true;
}
+bool GetLocalDirectory(NSSearchPathDirectory directory, FilePath* result) {
+ return GetSearchPathDirectory(directory, NSLocalDomainMask, result);
+}
+
+bool GetUserDirectory(NSSearchPathDirectory directory, FilePath* result) {
+ return GetSearchPathDirectory(directory, NSUserDomainMask, result);
+}
+
FilePath GetUserLibraryPath() {
FilePath user_library_path;
if (!GetUserDirectory(NSLibraryDirectory, &user_library_path)) {