Chromium Code Reviews| Index: ios/chrome/browser/chrome_paths.mm |
| diff --git a/ios/chrome/browser/chrome_paths.mm b/ios/chrome/browser/chrome_paths.mm |
| index 0a86fb562d00c2c8d04af06aeac8fc9a5c40be71..7a8ec5b8fc44966d60c8047e20f7a98cfdd4226c 100644 |
| --- a/ios/chrome/browser/chrome_paths.mm |
| +++ b/ios/chrome/browser/chrome_paths.mm |
| @@ -10,6 +10,8 @@ |
| #include "base/logging.h" |
| #include "base/path_service.h" |
| #include "base/threading/thread_restrictions.h" |
| +#include "components/gcm_driver/gcm_driver_constants.h" |
| +#include "ios/chrome/browser/chrome_paths_internal.h" |
| namespace ios { |
| namespace { |
| @@ -60,12 +62,24 @@ bool PathProvider(int key, base::FilePath* result) { |
| cur = cur.Append(FILE_PATH_LITERAL("data")); |
| break; |
| + case DIR_GLOBAL_GCM_STORE: |
| + if (!PathService::Get(DIR_USER_DATA, &cur)) |
| + return false; |
| + cur = cur.Append(gcm_driver::kGCMStoreDirname); |
| + break; |
| + |
| case FILE_LOCAL_STATE: |
| - if (!PathService::Get(ios::DIR_USER_DATA, &cur)) |
| + if (!PathService::Get(DIR_USER_DATA, &cur)) |
| return false; |
| cur = cur.Append(FILE_PATH_LITERAL("Local State")); |
| break; |
| + case FILE_RESOURCES_PACK: |
| + if (!base::PathService::Get(DIR_USER_DATA, &cur)) |
|
blundell
2015/11/04 12:14:26
This is base::DIR_MODULE in chrome_paths.cc. Any r
sdefresne
2015/11/04 13:27:42
No reason, it is a mistake, thank you for catching
|
| + return false; |
| + cur = cur.Append(FILE_PATH_LITERAL("resources.pak")); |
| + break; |
| + |
| default: |
| return false; |
| } |
| @@ -83,4 +97,24 @@ void RegisterPathProvider() { |
| PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); |
| } |
| +void GetUserCacheDirectory(const base::FilePath& browser_state_dir, |
| + base::FilePath* result) { |
| + // If the browser state directory is under ~/Library/Application Support, |
| + // use a suitable cache directory under ~/Library/Caches. |
| + |
| + // Default value in cases where any of the following fails. |
| + *result = browser_state_dir; |
| + |
| + base::FilePath app_data_dir; |
| + if (!PathService::Get(base::DIR_APP_DATA, &app_data_dir)) |
| + return; |
| + base::FilePath cache_dir; |
| + if (!PathService::Get(base::DIR_CACHE, &cache_dir)) |
| + return; |
| + if (!app_data_dir.AppendRelativePath(browser_state_dir, &cache_dir)) |
| + return; |
| + |
| + *result = cache_dir; |
| +} |
| + |
| } // namespace ios |