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 #ifndef CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_CONTENT_CONTENT_CONDITION_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_CONTENT_CONTENT_CONDITION_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_CONTENT_CONTENT_CONDITION_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_CONTENT_CONTENT_CONDITION_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 // for all URL patterns that need to be matched by this ContentCondition. | 74 // for all URL patterns that need to be matched by this ContentCondition. |
75 // This ID is registered in a URLMatcher that can inform us in case of a | 75 // This ID is registered in a URLMatcher that can inform us in case of a |
76 // match. | 76 // match. |
77 URLMatcherConditionSet::ID url_matcher_condition_set_id() const { | 77 URLMatcherConditionSet::ID url_matcher_condition_set_id() const { |
78 return url_matcher_conditions_->id(); | 78 return url_matcher_conditions_->id(); |
79 } | 79 } |
80 | 80 |
81 // If this Condition has a url filter, appends it to |condition_sets|. | 81 // If this Condition has a url filter, appends it to |condition_sets|. |
82 void GetURLMatcherConditionSets( | 82 void GetURLMatcherConditionSets( |
83 URLMatcherConditionSet::Vector* condition_sets) const { | 83 URLMatcherConditionSet::Vector* condition_sets) const { |
84 if (url_matcher_conditions_) | 84 if (url_matcher_conditions_.get()) |
85 condition_sets->push_back(url_matcher_conditions_); | 85 condition_sets->push_back(url_matcher_conditions_); |
86 } | 86 } |
87 | 87 |
88 // True if GetURLMatcherConditionSets would append anything to its | 88 // True if GetURLMatcherConditionSets would append anything to its |
89 // argument. | 89 // argument. |
90 bool has_url_matcher_condition_set() const { | 90 bool has_url_matcher_condition_set() const { |
91 return url_matcher_conditions_ != NULL; | 91 return url_matcher_conditions_.get() != NULL; |
92 } | 92 } |
93 | 93 |
94 // Returns the CSS selectors required to match by this condition. | 94 // Returns the CSS selectors required to match by this condition. |
95 const std::vector<std::string>& css_selectors() const { | 95 const std::vector<std::string>& css_selectors() const { |
96 return css_selectors_; | 96 return css_selectors_; |
97 } | 97 } |
98 | 98 |
99 private: | 99 private: |
100 scoped_refptr<URLMatcherConditionSet> url_matcher_conditions_; | 100 scoped_refptr<URLMatcherConditionSet> url_matcher_conditions_; |
101 std::vector<std::string> css_selectors_; | 101 std::vector<std::string> css_selectors_; |
102 | 102 |
103 DISALLOW_COPY_AND_ASSIGN(ContentCondition); | 103 DISALLOW_COPY_AND_ASSIGN(ContentCondition); |
104 }; | 104 }; |
105 | 105 |
106 typedef DeclarativeConditionSet<ContentCondition> ContentConditionSet; | 106 typedef DeclarativeConditionSet<ContentCondition> ContentConditionSet; |
107 | 107 |
108 } // namespace extensions | 108 } // namespace extensions |
109 | 109 |
110 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_CONTENT_CONTENT_CONDITION_H
_ | 110 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_CONTENT_CONTENT_CONDITION_H
_ |
OLD | NEW |