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

Side by Side Diff: extensions/common/features/complex_feature.cc

Issue 2813073003: Make all ComplexFeatures of single feature to be SimpleFeature. (Closed)
Patch Set: fix space Created 3 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
« no previous file with comments | « extensions/common/api/_permission_features.json ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/features/complex_feature.h" 5 #include "extensions/common/features/complex_feature.h"
6 6
7 namespace extensions { 7 namespace extensions {
8 8
9 ComplexFeature::ComplexFeature(std::vector<Feature*>* features) { 9 ComplexFeature::ComplexFeature(std::vector<Feature*>* features) {
10 DCHECK_GT(features->size(), 0UL); 10 DCHECK_GT(features->size(), 1UL);
11 for (Feature* f : *features) 11 for (Feature* f : *features)
12 features_.push_back(std::unique_ptr<Feature>(f)); 12 features_.push_back(std::unique_ptr<Feature>(f));
13 features->clear(); 13 features->clear();
14 no_parent_ = features_[0]->no_parent(); 14 no_parent_ = features_[0]->no_parent();
15 15
16 #if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) 16 #if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)
17 // Verify IsInternal and no_parent is consistent across all features. 17 // Verify IsInternal and no_parent is consistent across all features.
18 bool first_is_internal = features_[0]->IsInternal(); 18 bool first_is_internal = features_[0]->IsInternal();
19 for (FeatureList::const_iterator it = features_.begin() + 1; 19 for (FeatureList::const_iterator it = features_.begin() + 1;
20 it != features_.end(); 20 it != features_.end();
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 return false; 98 return false;
99 } 99 }
100 100
101 bool ComplexFeature::IsInternal() const { 101 bool ComplexFeature::IsInternal() const {
102 // Constructor verifies that composed features are consistent, thus we can 102 // Constructor verifies that composed features are consistent, thus we can
103 // return just the first feature's value. 103 // return just the first feature's value.
104 return features_[0]->IsInternal(); 104 return features_[0]->IsInternal();
105 } 105 }
106 106
107 } // namespace extensions 107 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/api/_permission_features.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698