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_webrequest/webrequest_condit
ion.h" | 5 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_condit
ion.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 condition_attributes_.begin(); | 107 condition_attributes_.begin(); |
108 i != condition_attributes_.end(); ++i) { | 108 i != condition_attributes_.end(); ++i) { |
109 if (!(*i)->IsFulfilled(*(request_data.data))) | 109 if (!(*i)->IsFulfilled(*(request_data.data))) |
110 return false; | 110 return false; |
111 } | 111 } |
112 return true; | 112 return true; |
113 } | 113 } |
114 | 114 |
115 void WebRequestCondition::GetURLMatcherConditionSets( | 115 void WebRequestCondition::GetURLMatcherConditionSets( |
116 URLMatcherConditionSet::Vector* condition_sets) const { | 116 URLMatcherConditionSet::Vector* condition_sets) const { |
117 if (url_matcher_conditions_) | 117 if (url_matcher_conditions_.get()) |
118 condition_sets->push_back(url_matcher_conditions_); | 118 condition_sets->push_back(url_matcher_conditions_); |
119 if (first_party_url_matcher_conditions_) | 119 if (first_party_url_matcher_conditions_.get()) |
120 condition_sets->push_back(first_party_url_matcher_conditions_); | 120 condition_sets->push_back(first_party_url_matcher_conditions_); |
121 } | 121 } |
122 | 122 |
123 // static | 123 // static |
124 scoped_ptr<WebRequestCondition> WebRequestCondition::Create( | 124 scoped_ptr<WebRequestCondition> WebRequestCondition::Create( |
125 URLMatcherConditionFactory* url_matcher_condition_factory, | 125 URLMatcherConditionFactory* url_matcher_condition_factory, |
126 const base::Value& condition, | 126 const base::Value& condition, |
127 std::string* error) { | 127 std::string* error) { |
128 const base::DictionaryValue* condition_dict = NULL; | 128 const base::DictionaryValue* condition_dict = NULL; |
129 if (!condition.GetAsDictionary(&condition_dict)) { | 129 if (!condition.GetAsDictionary(&condition_dict)) { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 | 190 |
191 if (!result->stages()) { | 191 if (!result->stages()) { |
192 *error = kConditionCannotBeFulfilled; | 192 *error = kConditionCannotBeFulfilled; |
193 return scoped_ptr<WebRequestCondition>(NULL); | 193 return scoped_ptr<WebRequestCondition>(NULL); |
194 } | 194 } |
195 | 195 |
196 return result.Pass(); | 196 return result.Pass(); |
197 } | 197 } |
198 | 198 |
199 } // namespace extensions | 199 } // namespace extensions |
OLD | NEW |