| 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 "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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |