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/browser/extensions/api/declarative_content/content_condition.h" | 5 #include "chrome/browser/extensions/api/declarative_content/content_condition.h" |
6 | 6 |
7 #include "base/stringprintf.h" | 7 #include "base/stringprintf.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/extensions/api/declarative_content/content_constants.h" | 9 #include "chrome/browser/extensions/api/declarative_content/content_constants.h" |
10 #include "chrome/common/extensions/matcher/url_matcher.h" | 10 #include "extensions/common/matcher/url_matcher_factory.h" |
11 #include "chrome/common/extensions/matcher/url_matcher_factory.h" | |
12 | 11 |
13 namespace keys = extensions::declarative_content_constants; | 12 namespace keys = extensions::declarative_content_constants; |
14 | 13 |
15 namespace { | 14 namespace { |
16 static extensions::URLMatcherConditionSet::ID g_next_id = 0; | 15 static extensions::URLMatcherConditionSet::ID g_next_id = 0; |
17 | 16 |
18 // TODO(jyasskin): improve error messaging to give more meaningful messages | 17 // TODO(jyasskin): improve error messaging to give more meaningful messages |
19 // to the extension developer. | 18 // to the extension developer. |
20 // Error messages: | 19 // Error messages: |
21 const char kExpectedDictionary[] = "A condition has to be a dictionary."; | 20 const char kExpectedDictionary[] = "A condition has to be a dictionary."; |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 url_matcher_conditions.insert( | 130 url_matcher_conditions.insert( |
132 url_matcher_condition_factory->CreateHostPrefixCondition("")); | 131 url_matcher_condition_factory->CreateHostPrefixCondition("")); |
133 url_matcher_condition_set = | 132 url_matcher_condition_set = |
134 new URLMatcherConditionSet(++g_next_id, url_matcher_conditions); | 133 new URLMatcherConditionSet(++g_next_id, url_matcher_conditions); |
135 } | 134 } |
136 return scoped_ptr<ContentCondition>( | 135 return scoped_ptr<ContentCondition>( |
137 new ContentCondition(url_matcher_condition_set, css_rules)); | 136 new ContentCondition(url_matcher_condition_set, css_rules)); |
138 } | 137 } |
139 | 138 |
140 } // namespace extensions | 139 } // namespace extensions |
OLD | NEW |