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

Unified Diff: chrome/browser/extensions/external_extension_util.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_extension_util.cc
===================================================================
--- chrome/browser/extensions/external_extension_util.cc (revision 0)
+++ chrome/browser/extensions/external_extension_util.cc (revision 0)
@@ -0,0 +1,36 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/extensions/external_extension_util.h"
+
+#include "base/bind.h"
+#include "base/file_path.h"
+#include "base/file_util.h"
+#include "base/json/json_file_value_serializer.h"
+#include "base/json/json_string_value_serializer.h"
+#include "base/string_util.h"
+#include "base/utf_string_conversions.h"
+#include "base/values.h"
+#include "base/version.h"
+
+
+// Caller takes ownership of the returned dictionary.
+DictionaryValue* ExternalExtensionUtil::ExtractPrefs(const FilePath& path,
+ base::ValueSerializer* serializer) {
Sam Kerner (Chrome) 2012/04/13 19:35:13 Style nit: "const" and "base::" should line up in
Alexandre Abreu 2012/04/13 21:52:38 Done.
+ 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;
+}
+

Powered by Google App Engine
This is Rietveld 408576698