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(scoped_ptr<FeatureList> features) { | 9 ComplexFeature::ComplexFeature(scoped_ptr<FeatureList> features) { |
10 DCHECK_GT(features->size(), 0UL); | 10 DCHECK_GT(features->size(), 0UL); |
(...skipping 19 matching lines...) Expand all Loading... |
30 << "Complex feature must have consistent values of " | 30 << "Complex feature must have consistent values of " |
31 "blocked_in_service_worker across all sub features."; | 31 "blocked_in_service_worker across all sub features."; |
32 } | 32 } |
33 #endif | 33 #endif |
34 } | 34 } |
35 | 35 |
36 ComplexFeature::~ComplexFeature() { | 36 ComplexFeature::~ComplexFeature() { |
37 } | 37 } |
38 | 38 |
39 Feature::Availability ComplexFeature::IsAvailableToManifest( | 39 Feature::Availability ComplexFeature::IsAvailableToManifest( |
40 const std::string& extension_id, Manifest::Type type, Location location, | 40 const std::string& extension_id, |
41 int manifest_version, Platform platform) const { | 41 Manifest::Type type, |
| 42 Manifest::Location location, |
| 43 int manifest_version, |
| 44 Platform platform) const { |
42 Feature::Availability first_availability = | 45 Feature::Availability first_availability = |
43 features_[0]->IsAvailableToManifest( | 46 features_[0]->IsAvailableToManifest( |
44 extension_id, type, location, manifest_version, platform); | 47 extension_id, type, location, manifest_version, platform); |
45 if (first_availability.is_available()) | 48 if (first_availability.is_available()) |
46 return first_availability; | 49 return first_availability; |
47 | 50 |
48 for (FeatureList::const_iterator it = features_.begin() + 1; | 51 for (FeatureList::const_iterator it = features_.begin() + 1; |
49 it != features_.end(); ++it) { | 52 it != features_.end(); ++it) { |
50 Availability availability = (*it)->IsAvailableToManifest( | 53 Availability availability = (*it)->IsAvailableToManifest( |
51 extension_id, type, location, manifest_version, platform); | 54 extension_id, type, location, manifest_version, platform); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 Context context) const { | 117 Context context) const { |
115 if (result == IS_AVAILABLE) | 118 if (result == IS_AVAILABLE) |
116 return std::string(); | 119 return std::string(); |
117 | 120 |
118 // TODO(justinlin): Form some kind of combined availabilities/messages from | 121 // TODO(justinlin): Form some kind of combined availabilities/messages from |
119 // SimpleFeatures. | 122 // SimpleFeatures. |
120 return features_[0]->GetAvailabilityMessage(result, type, url, context); | 123 return features_[0]->GetAvailabilityMessage(result, type, url, context); |
121 } | 124 } |
122 | 125 |
123 } // namespace extensions | 126 } // namespace extensions |
OLD | NEW |