| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/common/chrome_paths_internal.h" | 5 #include "chrome/common/chrome_paths_internal.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <shellapi.h> | 8 #include <shellapi.h> |
| 9 #include <shlobj.h> | 9 #include <shlobj.h> |
| 10 | 10 |
| 11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
| 12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 13 #include "chrome/common/chrome_constants.h" | 13 #include "chrome/common/chrome_constants.h" |
| 14 | 14 |
| 15 namespace chrome { | 15 namespace chrome { |
| 16 | 16 |
| 17 bool GetDefaultUserDataDirectory(FilePath* result) { | 17 bool GetDefaultUserDataDirectory(FilePath* result) { |
| 18 if (!PathService::Get(base::DIR_LOCAL_APP_DATA, result)) | 18 if (!PathService::Get(base::DIR_LOCAL_APP_DATA, result)) |
| 19 return false; | 19 return false; |
| 20 #if defined(GOOGLE_CHROME_BUILD) | 20 #if defined(GOOGLE_CHROME_BUILD) |
| 21 *result = result->Append(FILE_PATH_LITERAL("Google")); | 21 *result = result->Append(FILE_PATH_LITERAL("Google")); |
| 22 #endif | 22 #endif |
| 23 *result = result->Append(chrome::kBrowserAppName); | 23 *result = result->Append(chrome::kBrowserAppName); |
| 24 *result = result->Append(chrome::kUserDataDirname); | 24 *result = result->Append(chrome::kUserDataDirname); |
| 25 return true; | 25 return true; |
| 26 } | 26 } |
| 27 | 27 |
| 28 bool GetChromeFrameUserDataDirectory(FilePath* result) { |
| 29 if (!PathService::Get(base::DIR_LOCAL_APP_DATA, result)) |
| 30 return false; |
| 31 #if defined(GOOGLE_CHROME_BUILD) |
| 32 *result = result->Append(FILE_PATH_LITERAL("Google")); |
| 33 #endif |
| 34 *result = result->Append(L"Chrome Frame"); |
| 35 *result = result->Append(chrome::kUserDataDirname); |
| 36 return true; |
| 37 } |
| 38 |
| 28 bool GetUserDocumentsDirectory(FilePath* result) { | 39 bool GetUserDocumentsDirectory(FilePath* result) { |
| 29 wchar_t path_buf[MAX_PATH]; | 40 wchar_t path_buf[MAX_PATH]; |
| 30 if (FAILED(SHGetFolderPath(NULL, CSIDL_MYDOCUMENTS, NULL, | 41 if (FAILED(SHGetFolderPath(NULL, CSIDL_MYDOCUMENTS, NULL, |
| 31 SHGFP_TYPE_CURRENT, path_buf))) | 42 SHGFP_TYPE_CURRENT, path_buf))) |
| 32 return false; | 43 return false; |
| 33 *result = FilePath(path_buf); | 44 *result = FilePath(path_buf); |
| 34 return true; | 45 return true; |
| 35 } | 46 } |
| 36 | 47 |
| 37 // On Vista, we can get the download path using a Win API | 48 // On Vista, we can get the download path using a Win API |
| (...skipping 19 matching lines...) Expand all Loading... |
| 57 wchar_t system_buffer[MAX_PATH]; | 68 wchar_t system_buffer[MAX_PATH]; |
| 58 system_buffer[0] = 0; | 69 system_buffer[0] = 0; |
| 59 if (FAILED(SHGetFolderPath(NULL, CSIDL_DESKTOPDIRECTORY, NULL, | 70 if (FAILED(SHGetFolderPath(NULL, CSIDL_DESKTOPDIRECTORY, NULL, |
| 60 SHGFP_TYPE_CURRENT, system_buffer))) | 71 SHGFP_TYPE_CURRENT, system_buffer))) |
| 61 return false; | 72 return false; |
| 62 *result = FilePath(system_buffer); | 73 *result = FilePath(system_buffer); |
| 63 return true; | 74 return true; |
| 64 } | 75 } |
| 65 | 76 |
| 66 } // namespace chrome | 77 } // namespace chrome |
| OLD | NEW |