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

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,37 @@
+// 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"
+
+DictionaryValue* ExternalExtensionUtil::ExtractExtensionPrefs(
+ 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() << " .";
Finnur 2012/04/25 13:33:45 There is still a whitespace before period in the l
Alexandre Abreu 2012/04/25 15:31:05 Done.
+ return new DictionaryValue;
+ }
+
+ DictionaryValue * ext_dictionary = NULL;
Finnur 2012/04/25 13:33:45 DictionaryValue* not DictionaryValue *
Alexandre Abreu 2012/04/25 15:31:05 Done.
+ if (extensions->GetAsDictionary(&ext_dictionary)) {
+ return ext_dictionary;
+ }
Finnur 2012/04/25 13:33:45 nit: We don't use braces if the |if| clause (or th
Alexandre Abreu 2012/04/25 15:31:05 Done.
+
+ LOG(WARNING) << "Expected a JSON dictionary in file "
+ << path.value() << " .";
Finnur 2012/04/25 13:33:45 Same here (remove space before period).
Alexandre Abreu 2012/04/25 15:31:05 Done.
+ return new DictionaryValue;
+}
+

Powered by Google App Engine
This is Rietveld 408576698