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

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

Issue 9963120: Introduces an additional extension loader that load extra extensions based on per-extension json fi… (Closed) Base URL: https://src.chromium.org/svn/trunk/src/
Patch Set: Created 8 years, 8 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
===================================================================
--- chrome/browser/extensions/external_pref_extension_loader.cc (revision 133542)
+++ chrome/browser/extensions/external_pref_extension_loader.cc (working copy)
@@ -12,34 +12,12 @@
#include "base/logging.h"
#include "base/metrics/histogram.h"
#include "base/path_service.h"
+#include "chrome/browser/extensions/external_extension_util.h"
#include "chrome/common/chrome_paths.h"
#include "content/public/browser/browser_thread.h"
using content::BrowserThread;
-namespace {
-
-// Caller takes ownership of the returned dictionary.
-DictionaryValue* ExtractPrefs(const FilePath& path,
- base::ValueSerializer* serializer) {
- std::string error_msg;
- Value* extensions = serializer->Deserialize(NULL, &error_msg);
- if (!extensions) {
- LOG(WARNING) << "Unable to deserialize json data: " << error_msg
- << " In file " << path.value() << " .";
- } else {
- if (!extensions->IsType(Value::TYPE_DICTIONARY)) {
- LOG(WARNING) << "Expected a JSON dictionary in file "
- << path.value() << " .";
- } else {
- return static_cast<DictionaryValue*>(extensions);
- }
- }
- return new DictionaryValue;
-}
-
-} // namespace
-
ExternalPrefExtensionLoader::ExternalPrefExtensionLoader(int base_path_key,
Options options)
: base_path_key_(base_path_key),
@@ -100,8 +78,9 @@
}
JSONFileValueSerializer serializer(json_file);
- DictionaryValue* parsed_json_prefs = ExtractPrefs(json_file, &serializer);
- return parsed_json_prefs;
+ return ExternalExtensionUtil::ExtractExtensionPrefs(
+ json_file,
+ &serializer);
Finnur 2012/04/25 13:33:45 nit: This fits on one line. No?
Alexandre Abreu 2012/04/25 15:31:05 Done.
}
void ExternalPrefExtensionLoader::LoadOnFileThread() {
@@ -134,7 +113,9 @@
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
JSONStringValueSerializer serializer(json_data);
FilePath fake_json_path = fake_base_path.AppendASCII("fake.json");
- testing_prefs_.reset(ExtractPrefs(fake_json_path, &serializer));
+ testing_prefs_.reset(ExternalExtensionUtil::ExtractExtensionPrefs(
+ fake_json_path,
+ &serializer));
}
void ExternalTestingExtensionLoader::StartLoading() {

Powered by Google App Engine
This is Rietveld 408576698