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_attribute.h" | 5 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_condit
ion_attribute.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 | 191 |
192 bool WebRequestConditionAttributeContentType::IsFulfilled( | 192 bool WebRequestConditionAttributeContentType::IsFulfilled( |
193 const WebRequestRule::RequestData& request_data) { | 193 const WebRequestRule::RequestData& request_data) { |
194 if (!(request_data.stage & GetStages())) | 194 if (!(request_data.stage & GetStages())) |
195 return false; | 195 return false; |
196 std::string content_type; | 196 std::string content_type; |
197 request_data.original_response_headers->GetNormalizedHeader( | 197 request_data.original_response_headers->GetNormalizedHeader( |
198 net::HttpRequestHeaders::kContentType, &content_type); | 198 net::HttpRequestHeaders::kContentType, &content_type); |
199 std::string mime_type; | 199 std::string mime_type; |
200 std::string charset; | 200 std::string charset; |
201 bool had_charset; | 201 bool had_charset = false; |
202 net::HttpUtil::ParseContentType( | 202 net::HttpUtil::ParseContentType( |
203 content_type, &mime_type, &charset, &had_charset, NULL); | 203 content_type, &mime_type, &charset, &had_charset, NULL); |
204 | 204 |
205 return std::find(content_types_.begin(), content_types_.end(), | 205 return std::find(content_types_.begin(), content_types_.end(), |
206 mime_type) != content_types_.end(); | 206 mime_type) != content_types_.end(); |
207 } | 207 } |
208 | 208 |
209 WebRequestConditionAttribute::Type | 209 WebRequestConditionAttribute::Type |
210 WebRequestConditionAttributeContentType::GetType() const { | 210 WebRequestConditionAttributeContentType::GetType() const { |
211 return CONDITION_CONTENT_TYPE; | 211 return CONDITION_CONTENT_TYPE; |
212 } | 212 } |
213 | 213 |
214 } // namespace extensions | 214 } // namespace extensions |
OLD | NEW |