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

Side by Side Diff: extensions/common/extension_api.cc

Issue 2539363004: Make base::Value::TYPE a scoped enum. (Closed)
Patch Set: Rebase Created 4 years 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "extensions/common/extension_api.h" 5 #include "extensions/common/extension_api.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <string> 10 #include <string>
(...skipping 29 matching lines...) Expand all
40 const base::StringPiece& schema) { 40 const base::StringPiece& schema) {
41 std::string error_message; 41 std::string error_message;
42 std::unique_ptr<base::Value> result(base::JSONReader::ReadAndReturnError( 42 std::unique_ptr<base::Value> result(base::JSONReader::ReadAndReturnError(
43 schema, 43 schema,
44 base::JSON_PARSE_RFC | base::JSON_DETACHABLE_CHILDREN, // options 44 base::JSON_PARSE_RFC | base::JSON_DETACHABLE_CHILDREN, // options
45 NULL, // error code 45 NULL, // error code
46 &error_message)); 46 &error_message));
47 47
48 // Tracking down http://crbug.com/121424 48 // Tracking down http://crbug.com/121424
49 char buf[128]; 49 char buf[128];
50 base::snprintf(buf, arraysize(buf), "%s: (%d) '%s'", 50 base::snprintf(buf, arraysize(buf), "%s: (%d) '%s'", name.c_str(),
51 name.c_str(), 51 result.get() ? static_cast<int>(result->GetType()) : -1,
52 result.get() ? result->GetType() : -1, 52 error_message.c_str());
53 error_message.c_str());
54 53
55 CHECK(result.get()) << error_message << " for schema " << schema; 54 CHECK(result.get()) << error_message << " for schema " << schema;
56 CHECK(result->IsType(base::Value::TYPE_DICTIONARY)) << " for schema " 55 CHECK(result->IsType(base::Value::Type::DICTIONARY)) << " for schema "
57 << schema; 56 << schema;
58 return base::DictionaryValue::From(std::move(result)); 57 return base::DictionaryValue::From(std::move(result));
59 } 58 }
60 59
61 const base::DictionaryValue* FindListItem(const base::ListValue* list, 60 const base::DictionaryValue* FindListItem(const base::ListValue* list,
62 const std::string& property_name, 61 const std::string& property_name,
63 const std::string& property_value) { 62 const std::string& property_value) {
64 for (size_t i = 0; i < list->GetSize(); ++i) { 63 for (size_t i = 0; i < list->GetSize(); ++i) {
65 const base::DictionaryValue* item = NULL; 64 const base::DictionaryValue* item = NULL;
66 CHECK(list->GetDictionary(i, &item)) 65 CHECK(list->GetDictionary(i, &item))
67 << property_value << "/" << property_name; 66 << property_value << "/" << property_name;
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 if (!alias_feature) 355 if (!alias_feature)
357 alias_feature = provider->second->GetFeature(alias); 356 alias_feature = provider->second->GetFeature(alias);
358 357
359 CHECK(alias_feature) << "Cannot find alias feature " << alias 358 CHECK(alias_feature) << "Cannot find alias feature " << alias
360 << " for API feature " << feature->name(); 359 << " for API feature " << feature->name();
361 360
362 return alias_feature->IsAvailableToContext(extension, context, url); 361 return alias_feature->IsAvailableToContext(extension, context, url);
363 } 362 }
364 363
365 } // namespace extensions 364 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/verified_contents.cc ('k') | extensions/common/features/json_feature_provider_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698