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

Side by Side Diff: google_apis/drive/drive_api_requests.cc

Issue 2070283002: Use container::back() and container::pop_back(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 5 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
« no previous file with comments | « extensions/common/features/base_feature_provider.cc ('k') | google_apis/drive/time_util.cc » ('j') | 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 "google_apis/drive/drive_api_requests.h" 5 #include "google_apis/drive/drive_api_requests.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 base::StringPiece content_type_piece(content_type); 212 base::StringPiece content_type_piece(content_type);
213 if (!content_type_piece.starts_with(kMultipartMixedMimeTypePrefix)) { 213 if (!content_type_piece.starts_with(kMultipartMixedMimeTypePrefix)) {
214 return false; 214 return false;
215 } 215 }
216 content_type_piece.remove_prefix( 216 content_type_piece.remove_prefix(
217 base::StringPiece(kMultipartMixedMimeTypePrefix).size()); 217 base::StringPiece(kMultipartMixedMimeTypePrefix).size());
218 218
219 if (content_type_piece.empty()) 219 if (content_type_piece.empty())
220 return false; 220 return false;
221 if (content_type_piece[0] == '"') { 221 if (content_type_piece[0] == '"') {
222 if (content_type_piece.size() <= 2 || 222 if (content_type_piece.size() <= 2 || content_type_piece.back() != '"')
223 content_type_piece[content_type_piece.size() - 1] != '"') {
224 return false; 223 return false;
225 } 224
226 content_type_piece = 225 content_type_piece =
227 content_type_piece.substr(1, content_type_piece.size() - 2); 226 content_type_piece.substr(1, content_type_piece.size() - 2);
228 } 227 }
229 228
230 std::string boundary; 229 std::string boundary;
231 content_type_piece.CopyToString(&boundary); 230 content_type_piece.CopyToString(&boundary);
232 const std::string header = "--" + boundary; 231 const std::string header = "--" + boundary;
233 const std::string terminator = "--" + boundary + "--"; 232 const std::string terminator = "--" + boundary + "--";
234 233
235 std::vector<base::StringPiece> lines; 234 std::vector<base::StringPiece> lines;
(...skipping 1215 matching lines...) Expand 10 before | Expand all | Expand 10 after
1451 } else if (last_progress_value_ < child->data_offset + child->data_size && 1450 } else if (last_progress_value_ < child->data_offset + child->data_size &&
1452 child->data_offset + child->data_size < current) { 1451 child->data_offset + child->data_size < current) {
1453 child->request->NotifyUploadProgress(source, child->data_size, 1452 child->request->NotifyUploadProgress(source, child->data_size,
1454 child->data_size); 1453 child->data_size);
1455 } 1454 }
1456 } 1455 }
1457 last_progress_value_ = current; 1456 last_progress_value_ = current;
1458 } 1457 }
1459 } // namespace drive 1458 } // namespace drive
1460 } // namespace google_apis 1459 } // namespace google_apis
OLDNEW
« no previous file with comments | « extensions/common/features/base_feature_provider.cc ('k') | google_apis/drive/time_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698