summaryrefslogtreecommitdiffstats
path: root/chrome/common
diff options
context:
space:
mode:
authorskerner@google.com <skerner@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-22 14:47:18 +0000
committerskerner@google.com <skerner@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-22 14:47:18 +0000
commit73e4c36f363107b3b625001ebf524ca247c5220c (patch)
treeaeafb62d03121d1881aa36180d7dcab6e047a990 /chrome/common
parente4d9c1fb00637f609fb81e00c8e5be5d3c1c8230 (diff)
downloadchromium_src-73e4c36f363107b3b625001ebf524ca247c5220c.zip
chromium_src-73e4c36f363107b3b625001ebf524ca247c5220c.tar.gz
chromium_src-73e4c36f363107b3b625001ebf524ca247c5220c.tar.bz2
Add external extensions json source in proper mac location.
The old path will be deprecated once developers have migrated. BUG=67203 TEST=FileUtilTest.IsPathControledByAdmin Review URL: http://codereview.chromium.org/7718021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102274 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r--chrome/common/chrome_paths.cc29
-rw-r--r--chrome/common/chrome_paths.h7
-rw-r--r--chrome/common/chrome_paths_internal.h3
-rw-r--r--chrome/common/chrome_paths_mac.mm4
4 files changed, 35 insertions, 8 deletions
diff --git a/chrome/common/chrome_paths.cc b/chrome/common/chrome_paths.cc
index db1f2b5..3b3260f 100644
--- a/chrome/common/chrome_paths.cc
+++ b/chrome/common/chrome_paths.cc
@@ -334,16 +334,12 @@ bool PathProvider(int key, FilePath* result) {
#endif
case chrome::DIR_EXTERNAL_EXTENSIONS:
#if defined(OS_MACOSX)
- if (!PathService::Get(base::DIR_EXE, &cur))
+ if (!chrome::GetGlobalApplicationSupportDirectory(&cur))
return false;
- // On Mac, built-in extensions are in Contents/Extensions, a sibling of
- // the App dir. If there are none, it may not exist.
- // TODO(skerner): Reading external extensions from a file inside the
- // app budle causes several problems. Change this path to be outside
- // the app bundle. crbug/67203
- cur = cur.DirName();
- cur = cur.Append(FILE_PATH_LITERAL("Extensions"));
+ cur = cur.Append(FILE_PATH_LITERAL("Google"))
+ .Append(FILE_PATH_LITERAL("Chrome"))
+ .Append(FILE_PATH_LITERAL("External Extensions"));
create_dir = false;
#else
if (!PathService::Get(base::DIR_MODULE, &cur))
@@ -353,6 +349,22 @@ bool PathProvider(int key, FilePath* result) {
create_dir = true;
#endif
break;
+
+#if defined(OS_MACOSX)
+ case DIR_DEPRICATED_EXTERNAL_EXTENSIONS:
+ // TODO(skerner): Reading external extensions from a file inside the
+ // app budle causes several problems. Once users have a chance to
+ // migrate, remove this path. crbug/67203
+ if (!PathService::Get(base::DIR_EXE, &cur))
+ return false;
+
+ cur = cur.DirName();
+ cur = cur.Append(FILE_PATH_LITERAL("Extensions"));
+ create_dir = false;
+
+ break;
+#endif
+
case chrome::DIR_DEFAULT_APPS:
#if defined(OS_MACOSX)
cur = base::mac::MainAppBundlePath();
@@ -363,6 +375,7 @@ bool PathProvider(int key, FilePath* result) {
cur = cur.Append(FILE_PATH_LITERAL("default_apps"));
#endif
break;
+
default:
return false;
}
diff --git a/chrome/common/chrome_paths.h b/chrome/common/chrome_paths.h
index 78ca6b1..2462bf6 100644
--- a/chrome/common/chrome_paths.h
+++ b/chrome/common/chrome_paths.h
@@ -57,6 +57,13 @@ enum {
#endif
DIR_EXTERNAL_EXTENSIONS, // Directory where installer places .crx files.
+
+#if defined(OS_MACOSX)
+ DIR_DEPRICATED_EXTERNAL_EXTENSIONS, // Former home of external extensions.
+ // We read from the old path for now,
+ // to give users time to migrate.
+#endif
+
DIR_DEFAULT_APPS, // Directory where installer places .crx files
// to be installed when chrome is first run.
FILE_RESOURCE_MODULE, // Full path and filename of the module that
diff --git a/chrome/common/chrome_paths_internal.h b/chrome/common/chrome_paths_internal.h
index baf5777..23c3ec4 100644
--- a/chrome/common/chrome_paths_internal.h
+++ b/chrome/common/chrome_paths_internal.h
@@ -76,6 +76,9 @@ FilePath GetFrameworkBundlePath();
// Get the local library directory.
bool GetLocalLibraryDirectory(FilePath* result);
+// Get the global Application Support directory (under /Library/).
+bool GetGlobalApplicationSupportDirectory(FilePath* result);
+
// Returns the NSBundle for the outer browser application, even when running
// inside the helper. In unbundled applications, such as tests, returns nil.
NSBundle* OuterAppBundle();
diff --git a/chrome/common/chrome_paths_mac.mm b/chrome/common/chrome_paths_mac.mm
index 7331d78..9df7cd5 100644
--- a/chrome/common/chrome_paths_mac.mm
+++ b/chrome/common/chrome_paths_mac.mm
@@ -105,6 +105,10 @@ bool GetUserDocumentsDirectory(FilePath* result) {
return base::mac::GetUserDirectory(NSDocumentDirectory, result);
}
+bool GetGlobalApplicationSupportDirectory(FilePath* result) {
+ return base::mac::GetLocalDirectory(NSApplicationSupportDirectory, result);
+}
+
void GetUserCacheDirectory(const FilePath& profile_dir, FilePath* result) {
// If the profile directory is under ~/Library/Application Support,
// use a suitable cache directory under ~/Library/Caches. For