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

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

Issue 10003001: Update JSONReader to take base::StringPiece instead of std::string (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
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 unified diff | Download patch
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
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; 54 bool allow_trailing_comma = false;
55 std::string error_str; 55 std::string error_str;
56 scoped_ptr<base::Value> value(base::JSONReader::ReadAndReturnError( 56 scoped_ptr<base::Value> value(base::JSONReader::ReadAndReturnError(
57 json_resource.as_string(), 57 json_resource,
58 allow_trailing_comma, 58 allow_trailing_comma,
59 NULL, 59 NULL,
60 &error_str)); 60 &error_str));
61 if (!value.get()) { 61 if (!value.get()) {
62 DLOG(ERROR) << error_str; 62 DLOG(ERROR) << error_str;
63 return NULL; 63 return NULL;
64 } 64 }
65 if (value->GetType() != base::Value::TYPE_DICTIONARY) 65 if (value->GetType() != base::Value::TYPE_DICTIONARY)
66 return NULL; 66 return NULL;
67 return static_cast<base::DictionaryValue*>(value.release()); 67 return static_cast<base::DictionaryValue*>(value.release());
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 plugin_dict->GetBoolean("requires_authorization", &requires_authorization); 141 plugin_dict->GetBoolean("requires_authorization", &requires_authorization);
142 PluginInstaller* installer = new PluginInstaller(identifier, 142 PluginInstaller* installer = new PluginInstaller(identifier,
143 GURL(url), 143 GURL(url),
144 GURL(help_url), 144 GURL(help_url),
145 name, 145 name,
146 display_url, 146 display_url,
147 requires_authorization); 147 requires_authorization);
148 installers_[identifier] = installer; 148 installers_[identifier] = installer;
149 return installer; 149 return installer;
150 } 150 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698