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

Side by Side Diff: extensions/browser/api/web_request/upload_data_presenter.cc

Issue 2037703004: Remove ListValue::Append(new {Fundamental,String}Value(...)) pattern in //extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
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 "extensions/browser/api/web_request/upload_data_presenter.h" 5 #include "extensions/browser/api/web_request/upload_data_presenter.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 return; 118 return;
119 } 119 }
120 if (!parser_->SetSource(base::StringPiece(bytes_reader->bytes(), 120 if (!parser_->SetSource(base::StringPiece(bytes_reader->bytes(),
121 bytes_reader->length()))) { 121 bytes_reader->length()))) {
122 Abort(); 122 Abort();
123 return; 123 return;
124 } 124 }
125 125
126 FormDataParser::Result result; 126 FormDataParser::Result result;
127 while (parser_->GetNextNameValue(&result)) { 127 while (parser_->GetNextNameValue(&result)) {
128 GetOrCreateList(dictionary_.get(), result.name())->Append( 128 GetOrCreateList(dictionary_.get(), result.name())
129 new base::StringValue(result.value())); 129 ->AppendString(result.value());
130 } 130 }
131 } 131 }
132 132
133 bool ParsedDataPresenter::Succeeded() { 133 bool ParsedDataPresenter::Succeeded() {
134 if (success_ && !parser_->AllDataReadOK()) 134 if (success_ && !parser_->AllDataReadOK())
135 Abort(); 135 Abort();
136 return success_; 136 return success_;
137 } 137 }
138 138
139 std::unique_ptr<base::Value> ParsedDataPresenter::Result() { 139 std::unique_ptr<base::Value> ParsedDataPresenter::Result() {
(...skipping 16 matching lines...) Expand all
156 dictionary_(success_ ? new base::DictionaryValue() : NULL) { 156 dictionary_(success_ ? new base::DictionaryValue() : NULL) {
157 } 157 }
158 158
159 void ParsedDataPresenter::Abort() { 159 void ParsedDataPresenter::Abort() {
160 success_ = false; 160 success_ = false;
161 dictionary_.reset(); 161 dictionary_.reset();
162 parser_.reset(); 162 parser_.reset();
163 } 163 }
164 164
165 } // namespace extensions 165 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698