Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Side by Side Diff: chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute.cc

Issue 10834190: Fix (unexpected) use of uninitialized boolean in parsing of Content-Type. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698