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/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 return scoped_ptr<WebRequestCondition>(); | 147 return scoped_ptr<WebRequestCondition>(); |
148 } | 148 } |
149 | 149 |
150 WebRequestConditionAttributes attributes; | 150 WebRequestConditionAttributes attributes; |
151 scoped_refptr<URLMatcherConditionSet> url_matcher_condition_set; | 151 scoped_refptr<URLMatcherConditionSet> url_matcher_condition_set; |
152 scoped_refptr<URLMatcherConditionSet> first_party_url_matcher_condition_set; | 152 scoped_refptr<URLMatcherConditionSet> first_party_url_matcher_condition_set; |
153 | 153 |
154 for (base::DictionaryValue::Iterator iter(*condition_dict); | 154 for (base::DictionaryValue::Iterator iter(*condition_dict); |
155 !iter.IsAtEnd(); iter.Advance()) { | 155 !iter.IsAtEnd(); iter.Advance()) { |
156 const std::string& condition_attribute_name = iter.key(); | 156 const std::string& condition_attribute_name = iter.key(); |
157 const Value& condition_attribute_value = iter.value(); | 157 const base::Value& condition_attribute_value = iter.value(); |
158 const bool name_is_url = condition_attribute_name == keys::kUrlKey; | 158 const bool name_is_url = condition_attribute_name == keys::kUrlKey; |
159 if (condition_attribute_name == keys::kInstanceTypeKey) { | 159 if (condition_attribute_name == keys::kInstanceTypeKey) { |
160 // Skip this. | 160 // Skip this. |
161 } else if (name_is_url || | 161 } else if (name_is_url || |
162 condition_attribute_name == keys::kFirstPartyForCookiesUrlKey) { | 162 condition_attribute_name == keys::kFirstPartyForCookiesUrlKey) { |
163 const base::DictionaryValue* dict = NULL; | 163 const base::DictionaryValue* dict = NULL; |
164 if (!condition_attribute_value.GetAsDictionary(&dict)) { | 164 if (!condition_attribute_value.GetAsDictionary(&dict)) { |
165 *error = base::StringPrintf(kInvalidTypeOfParamter, | 165 *error = base::StringPrintf(kInvalidTypeOfParamter, |
166 condition_attribute_name.c_str()); | 166 condition_attribute_name.c_str()); |
167 } else { | 167 } else { |
(...skipping 27 matching lines...) Expand all Loading... |
195 | 195 |
196 if (!result->stages()) { | 196 if (!result->stages()) { |
197 *error = kConditionCannotBeFulfilled; | 197 *error = kConditionCannotBeFulfilled; |
198 return scoped_ptr<WebRequestCondition>(); | 198 return scoped_ptr<WebRequestCondition>(); |
199 } | 199 } |
200 | 200 |
201 return result.Pass(); | 201 return result.Pass(); |
202 } | 202 } |
203 | 203 |
204 } // namespace extensions | 204 } // namespace extensions |
OLD | NEW |