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

Unified Diff: chrome/browser/extensions/external_pref_extension_loader.cc

Issue 6293006: Allow relative paths to external extension files for some providers, error out for others. (Closed) Base URL: http://git.chromium.org/git/chromium.git
Patch Set: Tested registry install on windows. Created 9 years, 11 months 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
Index: chrome/browser/extensions/external_pref_extension_loader.cc
diff --git a/chrome/browser/extensions/external_pref_extension_loader.cc b/chrome/browser/extensions/external_pref_extension_loader.cc
index b1b5d473f4f59350f866a1240acf38fd70774f9e..387ae837d4a55aaa20d4a2218112e5ee4a71eba4 100644
--- a/chrome/browser/extensions/external_pref_extension_loader.cc
+++ b/chrome/browser/extensions/external_pref_extension_loader.cc
@@ -32,10 +32,19 @@ DictionaryValue* ExtractPrefs(ValueSerializer* serializer) {
} // namespace
-ExternalPrefExtensionLoader::ExternalPrefExtensionLoader() {
+ExternalPrefExtensionLoader::ExternalPrefExtensionLoader(int path_key)
+ : path_key_(path_key) {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
}
+const FilePath ExternalPrefExtensionLoader::GetBaseCrxFilePath() {
+ CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ FilePath external_file_path;
+ CHECK(PathService::Get(path_key_, &external_file_path));
+ return external_file_path;
+}
+
void ExternalPrefExtensionLoader::StartLoading() {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
BrowserThread::PostTask(
@@ -47,11 +56,12 @@ void ExternalPrefExtensionLoader::StartLoading() {
void ExternalPrefExtensionLoader::LoadOnFileThread() {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
+
FilePath json_file;
- PathService::Get(app::DIR_EXTERNAL_EXTENSIONS, &json_file);
+ CHECK(PathService::Get(path_key_, &json_file));
json_file = json_file.Append(FILE_PATH_LITERAL("external_extensions.json"));
- scoped_ptr<DictionaryValue> prefs;
+ scoped_ptr<DictionaryValue> prefs;
if (file_util::PathExists(json_file)) {
JSONFileValueSerializer serializer(json_file);
prefs.reset(ExtractPrefs(&serializer));
@@ -68,7 +78,9 @@ void ExternalPrefExtensionLoader::LoadOnFileThread() {
}
ExternalTestingExtensionLoader::ExternalTestingExtensionLoader(
- const std::string& json_data) {
+ const std::string& json_data,
+ const FilePath& fake_base_path)
+ : fake_base_path_(fake_base_path) {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
JSONStringValueSerializer serializer(json_data);
testing_prefs_.reset(ExtractPrefs(&serializer));
@@ -80,3 +92,7 @@ void ExternalTestingExtensionLoader::StartLoading() {
static_cast<DictionaryValue*>(testing_prefs_->DeepCopy()));
LoadFinished();
}
+
+const FilePath ExternalTestingExtensionLoader::GetBaseCrxFilePath() {
+ return fake_base_path_;
+}

Powered by Google App Engine
This is Rietveld 408576698