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

Side by Side Diff: chrome/common/extensions/api/extension_api.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: Sync with Parser changes Created 8 years, 6 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
« no previous file with comments | « chrome/browser/plugin_finder.cc ('k') | chrome/common/web_apps.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/common/extensions/api/extension_api.h" 5 #include "chrome/common/extensions/api/extension_api.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 base::StringPiece ReadFromResource(int resource_id) { 64 base::StringPiece ReadFromResource(int resource_id) {
65 return ResourceBundle::GetSharedInstance().GetRawDataResource( 65 return ResourceBundle::GetSharedInstance().GetRawDataResource(
66 resource_id, ui::SCALE_FACTOR_NONE); 66 resource_id, ui::SCALE_FACTOR_NONE);
67 } 67 }
68 68
69 scoped_ptr<ListValue> LoadSchemaList(const std::string& name, 69 scoped_ptr<ListValue> LoadSchemaList(const std::string& name,
70 const base::StringPiece& schema) { 70 const base::StringPiece& schema) {
71 std::string error_message; 71 std::string error_message;
72 scoped_ptr<Value> result( 72 scoped_ptr<Value> result(
73 base::JSONReader::ReadAndReturnError( 73 base::JSONReader::ReadAndReturnError(
74 schema.as_string(), 74 schema,
75 base::JSON_PARSE_RFC | base::JSON_DETACHABLE_CHILDREN, // options 75 base::JSON_PARSE_RFC | base::JSON_DETACHABLE_CHILDREN, // options
76 NULL, // error code 76 NULL, // error code
77 &error_message)); 77 &error_message));
78 78
79 // Tracking down http://crbug.com/121424 79 // Tracking down http://crbug.com/121424
80 char buf[128]; 80 char buf[128];
81 base::snprintf(buf, arraysize(buf), "%s: (%d) '%s'", 81 base::snprintf(buf, arraysize(buf), "%s: (%d) '%s'",
82 name.c_str(), 82 name.c_str(),
83 result.get() ? result->GetType() : -1, 83 result.get() ? result->GetType() : -1,
84 error_message.c_str()); 84 error_message.c_str());
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 799
800 void ExtensionAPI::LoadAllSchemas() { 800 void ExtensionAPI::LoadAllSchemas() {
801 while (unloaded_schemas_.size()) { 801 while (unloaded_schemas_.size()) {
802 std::map<std::string, base::StringPiece>::iterator it = 802 std::map<std::string, base::StringPiece>::iterator it =
803 unloaded_schemas_.begin(); 803 unloaded_schemas_.begin();
804 LoadSchema(it->first, it->second); 804 LoadSchema(it->first, it->second);
805 } 805 }
806 } 806 }
807 807
808 } // namespace extensions 808 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/plugin_finder.cc ('k') | chrome/common/web_apps.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698