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

Side by Side Diff: chrome/common/extensions/features/api_feature.cc

Issue 15091002: Lazily load API schemas from resource files and convert all APIs to features (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: optimize and "parent" property Created 7 years, 7 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/common/extensions/features/api_feature.h" 5 #include "chrome/common/extensions/features/api_feature.h"
6 6
7 namespace extensions { 7 namespace extensions {
8 8
9 APIFeature::APIFeature() : internal_(false) { 9 APIFeature::APIFeature() : internal_(false) {
10 } 10 }
11 11
12 APIFeature::~APIFeature() { 12 APIFeature::~APIFeature() {
13 } 13 }
14 14
15 bool APIFeature::IsInternal() const { 15 bool APIFeature::IsInternal() const {
16 return internal_; 16 return internal_;
17 } 17 }
18 18
19 bool APIFeature::HasParent() const {
20 return has_parent_;
21 }
22
19 std::string APIFeature::Parse(const DictionaryValue* value) { 23 std::string APIFeature::Parse(const DictionaryValue* value) {
20 std::string error = SimpleFeature::Parse(value); 24 std::string error = SimpleFeature::Parse(value);
21 if (!error.empty()) 25 if (!error.empty())
22 return error; 26 return error;
23 27
24 value->GetBoolean("internal", &internal_); 28 value->GetBoolean("internal", &internal_);
25 29
30 has_parent_ = value->HasKey("parent");
31
26 if (GetContexts()->empty()) 32 if (GetContexts()->empty())
27 return name() + ": API features must specify at least one context."; 33 return name() + ": API features must specify at least one context.";
28 34
29 return std::string(); 35 return std::string();
30 } 36 }
31 37
32 } // namespace 38 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698