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 #include "chrome/common/extensions/features/simple_feature.h" | 7 #include "chrome/common/extensions/features/simple_feature.h" |
8 | 8 |
9 namespace extensions { | 9 namespace extensions { |
10 | 10 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 // but if they get more complicated, we need to return some meaningful context | 65 // but if they get more complicated, we need to return some meaningful context |
66 // set. Either that or remove this method from the Feature interface. | 66 // set. Either that or remove this method from the Feature interface. |
67 return features_[0]->GetContexts(); | 67 return features_[0]->GetContexts(); |
68 } | 68 } |
69 | 69 |
70 bool ComplexFeature::IsInternal() const { | 70 bool ComplexFeature::IsInternal() const { |
71 NOTREACHED(); | 71 NOTREACHED(); |
72 return false; | 72 return false; |
73 } | 73 } |
74 | 74 |
| 75 bool ComplexFeature::HasParent() const { |
| 76 for (FeatureList::const_iterator it = features_.begin(); |
| 77 it != features_.end(); ++it) { |
| 78 if ((*it)->HasParent()) |
| 79 return true; |
| 80 } |
| 81 return false; |
| 82 } |
| 83 |
| 84 void ComplexFeature::SetHasParent(bool has_parent) { |
| 85 } |
| 86 |
75 std::string ComplexFeature::GetAvailabilityMessage(AvailabilityResult result, | 87 std::string ComplexFeature::GetAvailabilityMessage(AvailabilityResult result, |
76 Manifest::Type type, | 88 Manifest::Type type, |
77 const GURL& url) const { | 89 const GURL& url) const { |
78 if (result == IS_AVAILABLE) | 90 if (result == IS_AVAILABLE) |
79 return std::string(); | 91 return std::string(); |
80 | 92 |
81 // TODO(justinlin): Form some kind of combined availabilities/messages from | 93 // TODO(justinlin): Form some kind of combined availabilities/messages from |
82 // SimpleFeatures. | 94 // SimpleFeatures. |
83 return features_[0]->GetAvailabilityMessage(result, type, url); | 95 return features_[0]->GetAvailabilityMessage(result, type, url); |
84 } | 96 } |
85 | 97 |
86 bool ComplexFeature::IsIdInWhitelist(const std::string& extension_id) const { | 98 bool ComplexFeature::IsIdInWhitelist(const std::string& extension_id) const { |
87 for (FeatureList::const_iterator it = features_.begin(); | 99 for (FeatureList::const_iterator it = features_.begin(); |
88 it != features_.end(); ++it) { | 100 it != features_.end(); ++it) { |
89 if ((*it)->IsIdInWhitelist(extension_id)) | 101 if ((*it)->IsIdInWhitelist(extension_id)) |
90 return true; | 102 return true; |
91 } | 103 } |
92 return false; | 104 return false; |
93 } | 105 } |
94 | 106 |
95 } // namespace extensions | 107 } // namespace extensions |
OLD | NEW |