Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Unified Diff: ios/chrome/browser/chrome_paths.mm

Issue 1415573009: Add missing accessor to ios PathProvider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comment by blundell Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/chrome/browser/chrome_paths.h ('k') | ios/chrome/browser/chrome_paths_internal.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..7de53b9862217a977eb129a30932c8d0c470873c 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(base::DIR_MODULE, &cur))
+ 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
« no previous file with comments | « ios/chrome/browser/chrome_paths.h ('k') | ios/chrome/browser/chrome_paths_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698