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

Side by Side Diff: chrome/common/web_apps.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/common/extensions/api/extension_api.cc ('k') | net/base/crl_set.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/web_apps.h" 5 #include "chrome/common/web_apps.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 WebApplicationInfo* web_app, 211 WebApplicationInfo* web_app,
212 string16* error) { 212 string16* error) {
213 DCHECK(web_app->manifest_url.is_valid()); 213 DCHECK(web_app->manifest_url.is_valid());
214 214
215 int error_code = 0; 215 int error_code = 0;
216 std::string error_message; 216 std::string error_message;
217 scoped_ptr<Value> schema( 217 scoped_ptr<Value> schema(
218 base::JSONReader::ReadAndReturnError( 218 base::JSONReader::ReadAndReturnError(
219 ResourceBundle::GetSharedInstance().GetRawDataResource( 219 ResourceBundle::GetSharedInstance().GetRawDataResource(
220 IDR_WEB_APP_SCHEMA, 220 IDR_WEB_APP_SCHEMA,
221 ui::SCALE_FACTOR_NONE).as_string(), 221 ui::SCALE_FACTOR_NONE),
222 base::JSON_PARSE_RFC, // options 222 base::JSON_PARSE_RFC, // options
223 &error_code, 223 &error_code,
224 &error_message)); 224 &error_message));
225 DCHECK(schema.get()) 225 DCHECK(schema.get())
226 << "Error parsing JSON schema: " << error_code << ": " << error_message; 226 << "Error parsing JSON schema: " << error_code << ": " << error_message;
227 DCHECK(schema->IsType(Value::TYPE_DICTIONARY)) 227 DCHECK(schema->IsType(Value::TYPE_DICTIONARY))
228 << "schema root must be dictionary."; 228 << "schema root must be dictionary.";
229 229
230 JSONSchemaValidator validator(static_cast<DictionaryValue*>(schema.get())); 230 JSONSchemaValidator validator(static_cast<DictionaryValue*>(schema.get()));
231 231
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 web_app->app_url = app_url; 322 web_app->app_url = app_url;
323 web_app->urls = urls; 323 web_app->urls = urls;
324 web_app->permissions = permissions; 324 web_app->permissions = permissions;
325 web_app->icons = icons; 325 web_app->icons = icons;
326 326
327 return true; 327 return true;
328 328
329 } 329 }
330 330
331 } // namespace web_apps 331 } // namespace web_apps
OLDNEW
« no previous file with comments | « chrome/common/extensions/api/extension_api.cc ('k') | net/base/crl_set.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698