summaryrefslogtreecommitdiffstats
path: root/base/base_paths_mac.mm
diff options
context:
space:
mode:
authorgab@chromium.org <gab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-20 00:13:40 +0000
committergab@chromium.org <gab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-20 00:13:40 +0000
commite5738a07937558b0e79d047ac69dc119ac4920aa (patch)
treeed627cbcd774fd30b0ead5db2a6315ff8fba1f87 /base/base_paths_mac.mm
parent53895a82f11820984f1f872fa32231c9e61ee8fe (diff)
downloadchromium_src-e5738a07937558b0e79d047ac69dc119ac4920aa.zip
chromium_src-e5738a07937558b0e79d047ac69dc119ac4920aa.tar.gz
chromium_src-e5738a07937558b0e79d047ac69dc119ac4920aa.tar.bz2
Add new PathService paths for Windows' All Users Desktop and Quick Launch folders.
This allows usage of PathService to cache the paths and more importantly to mock them in shortcut tests! Also move chrome::DIR_USER_DESKTOP to base::DIR_USER_DESKTOP; this is really where it belongs. In fact it is only in chrome_paths.h because it used to be called DIR_DEFAULT_DOWNLOAD and cpu@ renamed it to DIR_USER_DESKTOP in http://crrev.com/1753 (early days!) after that it started to be used all over the place as the Desktop path. Finally bringing it to base_paths.h, beside DIR_START_MENU and friends, is the right thing to do imo. BUG=148539 TEST=Quick Launch shortcut installed in the right place on XP (both Default and current user) Desktop shortcuts installed in the right place (both All Users and per-user installs). installer_util_unittests.exe --gtest_filter=ShellUtilShortcutTest* unit_tests.exe --gtest_filter=ProfileShortcutManagerTest* base_unittests --gtest_filter=PathServiceTest* Review URL: https://chromiumcodereview.appspot.com/10910209 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@157667 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/base_paths_mac.mm')
-rw-r--r--base/base_paths_mac.mm17
1 files changed, 10 insertions, 7 deletions
diff --git a/base/base_paths_mac.mm b/base/base_paths_mac.mm
index 14d1c20..2227d7d 100644
--- a/base/base_paths_mac.mm
+++ b/base/base_paths_mac.mm
@@ -2,12 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/base_paths_mac.h"
+// Defines base::PathProviderMac which replaces base::PathProviderPosix for Mac
+// in base/path_service.cc.
#include <dlfcn.h>
#import <Foundation/Foundation.h>
#include <mach-o/dyld.h>
+#include "base/base_paths.h"
#include "base/compiler_specific.h"
#include "base/file_path.h"
#include "base/file_util.h"
@@ -15,6 +17,7 @@
#include "base/mac/foundation_util.h"
#include "base/path_service.h"
#include "base/string_util.h"
+#include "build/build_config.h"
namespace {
@@ -57,8 +60,6 @@ bool PathProviderMac(int key, FilePath* result) {
case base::FILE_MODULE:
return GetModulePathForAddress(result,
reinterpret_cast<const void*>(&base::PathProviderMac));
- case base::DIR_CACHE:
- return base::mac::GetUserDirectory(NSCachesDirectory, result);
case base::DIR_APP_DATA: {
bool success = base::mac::GetUserDirectory(NSApplicationSupportDirectory,
result);
@@ -69,7 +70,7 @@ bool PathProviderMac(int key, FilePath* result) {
#endif // defined(OS_IOS)
return success;
}
- case base::DIR_SOURCE_ROOT: {
+ case base::DIR_SOURCE_ROOT:
// Go through PathService to catch overrides.
if (!PathService::Get(base::FILE_EXE, result))
return false;
@@ -90,11 +91,13 @@ bool PathProviderMac(int key, FilePath* result) {
}
#endif
return true;
- }
- case base::DIR_HOME: {
+ case base::DIR_USER_DESKTOP:
+ return base::mac::GetUserDirectory(NSDesktopDirectory, result);
+ case base::DIR_CACHE:
+ return base::mac::GetUserDirectory(NSCachesDirectory, result);
+ case base::DIR_HOME:
*result = base::mac::NSStringToFilePath(NSHomeDirectory());
return true;
- }
default:
return false;
}