Chromium Code Reviews| 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; |
| +} |
| + |