| OLD | NEW |
| 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(), 0UL); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 bool ComplexFeature::IsIdInWhitelist(const std::string& extension_id) const { | 91 bool ComplexFeature::IsIdInWhitelist(const std::string& extension_id) const { |
| 92 for (FeatureList::const_iterator it = features_.begin(); | 92 for (FeatureList::const_iterator it = features_.begin(); |
| 93 it != features_.end(); | 93 it != features_.end(); |
| 94 ++it) { | 94 ++it) { |
| 95 if ((*it)->IsIdInWhitelist(extension_id)) | 95 if ((*it)->IsIdInWhitelist(extension_id)) |
| 96 return true; | 96 return true; |
| 97 } | 97 } |
| 98 return false; | 98 return false; |
| 99 } | 99 } |
| 100 | 100 |
| 101 std::string ComplexFeature::GetAlias() const { |
| 102 for (FeatureList::const_iterator it = features_.begin(); |
| 103 it != features_.end(); ++it) { |
| 104 std::string alias = (*it)->GetAlias(); |
| 105 if (!alias.empty()) |
| 106 return alias; |
| 107 } |
| 108 |
| 109 return std::string(); |
| 110 } |
| 111 |
| 112 std::string ComplexFeature::GetSource() const { |
| 113 for (FeatureList::const_iterator it = features_.begin(); |
| 114 it != features_.end(); ++it) { |
| 115 std::string source = (*it)->GetSource(); |
| 116 if (!source.empty()) |
| 117 return source; |
| 118 } |
| 119 |
| 120 return std::string(); |
| 121 } |
| 122 |
| 101 bool ComplexFeature::IsInternal() const { | 123 bool ComplexFeature::IsInternal() const { |
| 102 // Constructor verifies that composed features are consistent, thus we can | 124 // Constructor verifies that composed features are consistent, thus we can |
| 103 // return just the first feature's value. | 125 // return just the first feature's value. |
| 104 return features_[0]->IsInternal(); | 126 return features_[0]->IsInternal(); |
| 105 } | 127 } |
| 106 | 128 |
| 107 } // namespace extensions | 129 } // namespace extensions |
| OLD | NEW |