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

Side by Side Diff: chrome/browser/extensions/api/web_request/form_data_parser.cc

Issue 140613002: Cleanup: Replace &LazyInstance::Get() with LazyInstance::Pointer(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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
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/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/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 const net::UnescapeRule::Type FormDataParserUrlEncoded::unescape_rules_ = 352 const net::UnescapeRule::Type FormDataParserUrlEncoded::unescape_rules_ =
353 net::UnescapeRule::URL_SPECIAL_CHARS | net::UnescapeRule::CONTROL_CHARS | 353 net::UnescapeRule::URL_SPECIAL_CHARS | net::UnescapeRule::CONTROL_CHARS |
354 net::UnescapeRule::SPACES | net::UnescapeRule::REPLACE_PLUS_WITH_SPACE; 354 net::UnescapeRule::SPACES | net::UnescapeRule::REPLACE_PLUS_WITH_SPACE;
355 355
356 FormDataParserUrlEncoded::FormDataParserUrlEncoded() 356 FormDataParserUrlEncoded::FormDataParserUrlEncoded()
357 : source_(NULL), 357 : source_(NULL),
358 source_set_(false), 358 source_set_(false),
359 source_malformed_(false), 359 source_malformed_(false),
360 arg_name_(&name_), 360 arg_name_(&name_),
361 arg_value_(&value_), 361 arg_value_(&value_),
362 patterns_(&(g_patterns.Get())) { 362 patterns_(g_patterns.Pointer()) {
363 args_[0] = &arg_name_; 363 args_[0] = &arg_name_;
364 args_[1] = &arg_value_; 364 args_[1] = &arg_value_;
365 } 365 }
366 366
367 FormDataParserUrlEncoded::~FormDataParserUrlEncoded() {} 367 FormDataParserUrlEncoded::~FormDataParserUrlEncoded() {}
368 368
369 bool FormDataParserUrlEncoded::AllDataReadOK() { 369 bool FormDataParserUrlEncoded::AllDataReadOK() {
370 // All OK means we read the whole source. 370 // All OK means we read the whole source.
371 return source_set_ && source_.size() == 0 && !source_malformed_; 371 return source_set_ && source_.size() == 0 && !source_malformed_;
372 } 372 }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 bool FormDataParserMultipart::StartsWithPattern(const re2::StringPiece& input, 437 bool FormDataParserMultipart::StartsWithPattern(const re2::StringPiece& input,
438 const RE2& pattern) { 438 const RE2& pattern) {
439 return pattern.Match(input, 0, input.size(), RE2::ANCHOR_START, NULL, 0); 439 return pattern.Match(input, 0, input.size(), RE2::ANCHOR_START, NULL, 0);
440 } 440 }
441 441
442 FormDataParserMultipart::FormDataParserMultipart( 442 FormDataParserMultipart::FormDataParserMultipart(
443 const std::string& boundary_separator) 443 const std::string& boundary_separator)
444 : dash_boundary_pattern_( 444 : dash_boundary_pattern_(
445 CreateBoundaryPatternFromLiteral(boundary_separator)), 445 CreateBoundaryPatternFromLiteral(boundary_separator)),
446 state_(dash_boundary_pattern_.ok() ? STATE_INIT : STATE_ERROR), 446 state_(dash_boundary_pattern_.ok() ? STATE_INIT : STATE_ERROR),
447 patterns_(&(g_patterns.Get())) {} 447 patterns_(g_patterns.Pointer()) {}
448 448
449 FormDataParserMultipart::~FormDataParserMultipart() {} 449 FormDataParserMultipart::~FormDataParserMultipart() {}
450 450
451 bool FormDataParserMultipart::AllDataReadOK() { 451 bool FormDataParserMultipart::AllDataReadOK() {
452 return state_ == STATE_FINISHED; 452 return state_ == STATE_FINISHED;
453 } 453 }
454 454
455 bool FormDataParserMultipart::FinishReadingPart(base::StringPiece* data) { 455 bool FormDataParserMultipart::FinishReadingPart(base::StringPiece* data) {
456 const char* data_start = source_.data(); 456 const char* data_start = source_.data();
457 while (!StartsWithPattern(source_, dash_boundary_pattern_)) { 457 while (!StartsWithPattern(source_, dash_boundary_pattern_)) {
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 if (value_pattern().Match(header, 590 if (value_pattern().Match(header,
591 g_content_disposition_length, header.size(), 591 g_content_disposition_length, header.size(),
592 RE2::UNANCHORED, groups, 2)) { 592 RE2::UNANCHORED, groups, 2)) {
593 value->set(groups[1].data(), groups[1].size()); 593 value->set(groups[1].data(), groups[1].size());
594 *value_assigned = true; 594 *value_assigned = true;
595 } 595 }
596 return true; 596 return true;
597 } 597 }
598 598
599 } // namespace extensions 599 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698