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/web_request/form_data_parser.h" | 5 #include "chrome/browser/extensions/api/web_request/form_data_parser.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 const Patterns* patterns_; | 279 const Patterns* patterns_; |
280 | 280 |
281 DISALLOW_COPY_AND_ASSIGN(FormDataParserMultipart); | 281 DISALLOW_COPY_AND_ASSIGN(FormDataParserMultipart); |
282 }; | 282 }; |
283 | 283 |
284 // Implementation of FormDataParser and FormDataParser::Result. | 284 // Implementation of FormDataParser and FormDataParser::Result. |
285 | 285 |
286 FormDataParser::Result::Result() {} | 286 FormDataParser::Result::Result() {} |
287 FormDataParser::Result::~Result() {} | 287 FormDataParser::Result::~Result() {} |
288 | 288 |
289 void FormDataParser::Result::Reset() { | |
290 name_.erase(); | |
291 value_.erase(); | |
292 } | |
293 | |
294 FormDataParser::~FormDataParser() {} | 289 FormDataParser::~FormDataParser() {} |
295 | 290 |
296 // static | 291 // static |
297 scoped_ptr<FormDataParser> FormDataParser::Create( | 292 scoped_ptr<FormDataParser> FormDataParser::Create( |
298 const net::URLRequest& request) { | 293 const net::URLRequest& request) { |
299 std::string value; | 294 std::string value; |
300 const bool found = request.extra_request_headers().GetHeader( | 295 const bool found = request.extra_request_headers().GetHeader( |
301 net::HttpRequestHeaders::kContentType, &value); | 296 net::HttpRequestHeaders::kContentType, &value); |
302 return CreateFromContentTypeHeader(found ? &value : NULL); | 297 return CreateFromContentTypeHeader(found ? &value : NULL); |
303 } | 298 } |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 if (value_pattern().Match(header, | 577 if (value_pattern().Match(header, |
583 g_content_disposition_length, header.size(), | 578 g_content_disposition_length, header.size(), |
584 RE2::UNANCHORED, groups, 2)) { | 579 RE2::UNANCHORED, groups, 2)) { |
585 value->set(groups[1].data(), groups[1].size()); | 580 value->set(groups[1].data(), groups[1].size()); |
586 *value_assigned = true; | 581 *value_assigned = true; |
587 } | 582 } |
588 return true; | 583 return true; |
589 } | 584 } |
590 | 585 |
591 } // namespace extensions | 586 } // namespace extensions |
OLD | NEW |