diff options
author | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-03 17:36:49 +0000 |
---|---|---|
committer | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-03 17:36:49 +0000 |
commit | 0ba955b4e574625fd58307bca11613a5982ffe34 (patch) | |
tree | e44ed6ee99cb4f1f6e31afea8b112f3d7fbab380 /chrome/common/chrome_paths.cc | |
parent | c47677eff181547b63ae86ac6cafd0169efee4f0 (diff) | |
download | chromium_src-0ba955b4e574625fd58307bca11613a5982ffe34.zip chromium_src-0ba955b4e574625fd58307bca11613a5982ffe34.tar.gz chromium_src-0ba955b4e574625fd58307bca11613a5982ffe34.tar.bz2 |
Factor out platform specific chrome_paths calls into platform specific files.
Review URL: http://codereview.chromium.org/19760
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9088 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/chrome_paths.cc')
-rw-r--r-- | chrome/common/chrome_paths.cc | 70 |
1 files changed, 5 insertions, 65 deletions
diff --git a/chrome/common/chrome_paths.cc b/chrome/common/chrome_paths.cc index 2ca8dc1..c3c542d 100644 --- a/chrome/common/chrome_paths.cc +++ b/chrome/common/chrome_paths.cc @@ -2,14 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "build/build_config.h" - -#if defined(OS_WIN) -#include <windows.h> -#include <shellapi.h> -#include <shlobj.h> -#endif - #include "chrome/common/chrome_paths.h" #include "base/command_line.h" @@ -20,33 +12,11 @@ #include "base/string_util.h" #include "base/sys_info.h" #include "chrome/common/chrome_constants.h" +#include "chrome/common/chrome_paths_internal.h" #include "chrome/common/chrome_switches.h" namespace chrome { -// Gets the default user data directory, regardless of whether -// DIR_USER_DATA has been overridden by a command-line option. -bool GetDefaultUserDataDirectory(FilePath* result) { -#if defined(OS_WIN) - if (!PathService::Get(base::DIR_LOCAL_APP_DATA, result)) - return false; -#if defined(GOOGLE_CHROME_BUILD) - *result = result->Append(FILE_PATH_LITERAL("Google")); -#endif - *result = result->Append(chrome::kBrowserAppName); - *result = result->Append(chrome::kUserDataDirname); - return true; -#elif defined(OS_MACOSX) - if (!PathService::Get(base::DIR_LOCAL_APP_DATA, result)) - return false; - return true; -#elif defined(OS_LINUX) - // TODO(port): Decide what to do on linux. - NOTIMPLEMENTED(); - return false; -#endif // defined(OS_WIN) -} - bool GetGearsPluginPathFromCommandLine(FilePath* path) { #ifndef NDEBUG // for debugging, support a cmd line based override @@ -88,20 +58,8 @@ bool PathProvider(int key, FilePath* result) { create_dir = true; break; case chrome::DIR_USER_DOCUMENTS: -#if defined(OS_WIN) - { - wchar_t path_buf[MAX_PATH]; - if (FAILED(SHGetFolderPath(NULL, CSIDL_MYDOCUMENTS, NULL, - SHGFP_TYPE_CURRENT, path_buf))) - return false; - cur = FilePath(path_buf); - } -#else - // TODO(port): Get the path (possibly using xdg-user-dirs) - // or decide we don't need it on other platforms. - NOTIMPLEMENTED(); - return false; -#endif + if (!GetUserDocumentsDirectory(&cur)) + return false; create_dir = true; break; case chrome::DIR_DEFAULT_DOWNLOADS: @@ -129,26 +87,8 @@ bool PathProvider(int key, FilePath* result) { create_dir = true; break; case chrome::DIR_USER_DESKTOP: -#if defined(OS_WIN) - { - // We need to go compute the value. It would be nice to support paths - // with names longer than MAX_PATH, but the system functions don't seem - // to be designed for it either, with the exception of GetTempPath - // (but other things will surely break if the temp path is too long, - // so we don't bother handling it. - wchar_t system_buffer[MAX_PATH]; - system_buffer[0] = 0; - if (FAILED(SHGetFolderPath(NULL, CSIDL_DESKTOPDIRECTORY, NULL, - SHGFP_TYPE_CURRENT, system_buffer))) - return false; - cur = FilePath(system_buffer); - } -#else - // TODO(port): Get the path (possibly using xdg-user-dirs) - // or decide we don't need it on other platforms. - NOTIMPLEMENTED(); - return false; -#endif + if (!GetUserDesktop(&cur)) + return false; break; case chrome::DIR_RESOURCES: if (!PathService::Get(chrome::DIR_APP, &cur)) |