OLD | NEW |
---|---|
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/complex_feature.h" | 5 #include "chrome/common/extensions/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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
59 | 59 |
60 std::set<Feature::Context>* ComplexFeature::GetContexts() { | 60 std::set<Feature::Context>* ComplexFeature::GetContexts() { |
61 // TODO(justinlin): Current use cases for ComplexFeatures are simple (e.g. | 61 // TODO(justinlin): Current use cases for ComplexFeatures are simple (e.g. |
62 // allow API in dev channel for everyone but stable channel for a whitelist), | 62 // allow API in dev channel for everyone but stable channel for a whitelist), |
63 // but if they get more complicated, we need to return some meaningful context | 63 // but if they get more complicated, we need to return some meaningful context |
64 // set. Either that or remove this method from the Feature interface. | 64 // set. Either that or remove this method from the Feature interface. |
65 return features_[0]->GetContexts(); | 65 return features_[0]->GetContexts(); |
66 } | 66 } |
67 | 67 |
68 bool ComplexFeature::IsInternal() const { | 68 bool ComplexFeature::IsInternal() const { |
69 NOTREACHED(); | 69 // TODO(justinlin): Handle this correctly. |
Finnur
2013/10/15 10:44:21
Um.... ? What is this about?
justinlin
2013/10/16 07:06:48
Clarified.. somewhat. It's mostly because we are e
| |
70 return false; | 70 return false; |
71 } | 71 } |
72 | 72 |
73 std::string ComplexFeature::GetAvailabilityMessage(AvailabilityResult result, | 73 std::string ComplexFeature::GetAvailabilityMessage(AvailabilityResult result, |
74 Manifest::Type type, | 74 Manifest::Type type, |
75 const GURL& url) const { | 75 const GURL& url) const { |
76 if (result == IS_AVAILABLE) | 76 if (result == IS_AVAILABLE) |
77 return std::string(); | 77 return std::string(); |
78 | 78 |
79 // TODO(justinlin): Form some kind of combined availabilities/messages from | 79 // TODO(justinlin): Form some kind of combined availabilities/messages from |
80 // SimpleFeatures. | 80 // SimpleFeatures. |
81 return features_[0]->GetAvailabilityMessage(result, type, url); | 81 return features_[0]->GetAvailabilityMessage(result, type, url); |
82 } | 82 } |
83 | 83 |
84 bool ComplexFeature::IsIdInWhitelist(const std::string& extension_id) const { | 84 bool ComplexFeature::IsIdInWhitelist(const std::string& extension_id) const { |
85 for (FeatureList::const_iterator it = features_.begin(); | 85 for (FeatureList::const_iterator it = features_.begin(); |
86 it != features_.end(); ++it) { | 86 it != features_.end(); ++it) { |
87 if ((*it)->IsIdInWhitelist(extension_id)) | 87 if ((*it)->IsIdInWhitelist(extension_id)) |
88 return true; | 88 return true; |
89 } | 89 } |
90 return false; | 90 return false; |
91 } | 91 } |
92 | 92 |
93 } // namespace extensions | 93 } // namespace extensions |
OLD | NEW |