| 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 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1387 } | 1387 } |
| 1388 | 1388 |
| 1389 std::vector<std::string> BatchUploadRequest::GetExtraRequestHeaders() const { | 1389 std::vector<std::string> BatchUploadRequest::GetExtraRequestHeaders() const { |
| 1390 std::vector<std::string> headers; | 1390 std::vector<std::string> headers; |
| 1391 headers.push_back(kBatchUploadHeader); | 1391 headers.push_back(kBatchUploadHeader); |
| 1392 return headers; | 1392 return headers; |
| 1393 } | 1393 } |
| 1394 | 1394 |
| 1395 void BatchUploadRequest::ProcessURLFetchResults(const net::URLFetcher* source) { | 1395 void BatchUploadRequest::ProcessURLFetchResults(const net::URLFetcher* source) { |
| 1396 // Return the detailed raw HTTP code if the error code is abstracted | 1396 // Return the detailed raw HTTP code if the error code is abstracted |
| 1397 // DRIVE_OTHER_ERROR. | 1397 // DRIVE_OTHER_ERROR. If HTTP connection is failed and the status code is -1, |
| 1398 UMA_HISTOGRAM_SPARSE_SLOWLY(kUMADriveBatchUploadResponseCode, | 1398 // return network status error. |
| 1399 GetErrorCode() != DRIVE_OTHER_ERROR | 1399 int histogram_error = 0; |
| 1400 ? GetErrorCode() | 1400 if (GetErrorCode() != DRIVE_OTHER_ERROR) { |
| 1401 : source->GetResponseCode()); | 1401 histogram_error = GetErrorCode(); |
| 1402 } else if (source->GetResponseCode() != -1) { |
| 1403 histogram_error = source->GetResponseCode(); |
| 1404 } else { |
| 1405 histogram_error = source->GetStatus().error(); |
| 1406 } |
| 1407 UMA_HISTOGRAM_SPARSE_SLOWLY( |
| 1408 kUMADriveBatchUploadResponseCode, histogram_error); |
| 1402 | 1409 |
| 1403 if (!IsSuccessfulDriveApiErrorCode(GetErrorCode())) { | 1410 if (!IsSuccessfulDriveApiErrorCode(GetErrorCode())) { |
| 1404 RunCallbackOnPrematureFailure(GetErrorCode()); | 1411 RunCallbackOnPrematureFailure(GetErrorCode()); |
| 1405 sender_->RequestFinished(this); | 1412 sender_->RequestFinished(this); |
| 1406 return; | 1413 return; |
| 1407 } | 1414 } |
| 1408 | 1415 |
| 1409 std::string content_type; | 1416 std::string content_type; |
| 1410 source->GetResponseHeaders()->EnumerateHeader( | 1417 source->GetResponseHeaders()->EnumerateHeader( |
| 1411 /* need only first header */ NULL, "Content-Type", &content_type); | 1418 /* need only first header */ NULL, "Content-Type", &content_type); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1450 } else if (last_progress_value_ < child->data_offset + child->data_size && | 1457 } else if (last_progress_value_ < child->data_offset + child->data_size && |
| 1451 child->data_offset + child->data_size < current) { | 1458 child->data_offset + child->data_size < current) { |
| 1452 child->request->NotifyUploadProgress(source, child->data_size, | 1459 child->request->NotifyUploadProgress(source, child->data_size, |
| 1453 child->data_size); | 1460 child->data_size); |
| 1454 } | 1461 } |
| 1455 } | 1462 } |
| 1456 last_progress_value_ = current; | 1463 last_progress_value_ = current; |
| 1457 } | 1464 } |
| 1458 } // namespace drive | 1465 } // namespace drive |
| 1459 } // namespace google_apis | 1466 } // namespace google_apis |
| OLD | NEW |