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

Side by Side Diff: chrome/browser/plugin_finder.cc

Issue 9960077: Modify the base::JSONReader interface to take a set of options rather than a boolean flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/plugin_finder.h" 5 #include "chrome/browser/plugin_finder.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 // static 44 // static
45 scoped_ptr<DictionaryValue> PluginFinder::LoadPluginList() { 45 scoped_ptr<DictionaryValue> PluginFinder::LoadPluginList() {
46 return scoped_ptr<DictionaryValue>(LoadPluginListInternal()); 46 return scoped_ptr<DictionaryValue>(LoadPluginListInternal());
47 } 47 }
48 48
49 DictionaryValue* PluginFinder::LoadPluginListInternal() { 49 DictionaryValue* PluginFinder::LoadPluginListInternal() {
50 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) 50 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX)
51 base::StringPiece json_resource( 51 base::StringPiece json_resource(
52 ResourceBundle::GetSharedInstance().GetRawDataResource( 52 ResourceBundle::GetSharedInstance().GetRawDataResource(
53 IDR_PLUGIN_DB_JSON)); 53 IDR_PLUGIN_DB_JSON));
54 bool allow_trailing_comma = false;
55 std::string error_str; 54 std::string error_str;
56 scoped_ptr<base::Value> value(base::JSONReader::ReadAndReturnError( 55 scoped_ptr<base::Value> value(base::JSONReader::ReadAndReturnError(
57 json_resource.as_string(), 56 json_resource.as_string(),
58 allow_trailing_comma, 57 base::JSON_PARSE_RFC,
59 NULL, 58 NULL,
60 &error_str)); 59 &error_str));
61 if (!value.get()) { 60 if (!value.get()) {
62 DLOG(ERROR) << error_str; 61 DLOG(ERROR) << error_str;
63 return NULL; 62 return NULL;
64 } 63 }
65 if (value->GetType() != base::Value::TYPE_DICTIONARY) 64 if (value->GetType() != base::Value::TYPE_DICTIONARY)
66 return NULL; 65 return NULL;
67 return static_cast<base::DictionaryValue*>(value.release()); 66 return static_cast<base::DictionaryValue*>(value.release());
68 #else 67 #else
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 plugin_dict->GetBoolean("requires_authorization", &requires_authorization); 140 plugin_dict->GetBoolean("requires_authorization", &requires_authorization);
142 PluginInstaller* installer = new PluginInstaller(identifier, 141 PluginInstaller* installer = new PluginInstaller(identifier,
143 GURL(url), 142 GURL(url),
144 GURL(help_url), 143 GURL(help_url),
145 name, 144 name,
146 display_url, 145 display_url,
147 requires_authorization); 146 requires_authorization);
148 installers_[identifier] = installer; 147 installers_[identifier] = installer;
149 return installer; 148 return installer;
150 } 149 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698