| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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/chromeos/policy/upload_job_impl.h" | 5 #include "chrome/browser/chromeos/policy/upload_job_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 SYSLOG(ERROR) << "URLRequestStatus error " << status.error(); | 404 SYSLOG(ERROR) << "URLRequestStatus error " << status.error(); |
| 405 HandleError(NETWORK_ERROR); | 405 HandleError(NETWORK_ERROR); |
| 406 } else { | 406 } else { |
| 407 const int response_code = source->GetResponseCode(); | 407 const int response_code = source->GetResponseCode(); |
| 408 if (response_code == net::HTTP_OK) { | 408 if (response_code == net::HTTP_OK) { |
| 409 // Successful upload | 409 // Successful upload |
| 410 upload_fetcher_.reset(); | 410 upload_fetcher_.reset(); |
| 411 access_token_.clear(); | 411 access_token_.clear(); |
| 412 post_data_.reset(); | 412 post_data_.reset(); |
| 413 state_ = SUCCESS; | 413 state_ = SUCCESS; |
| 414 UMA_HISTOGRAM_ENUMERATION(kUploadJobSuccessHistogram, retry_, | 414 UMA_HISTOGRAM_EXACT_LINEAR( |
| 415 UploadJobSuccess::REQUEST_MAX); | 415 kUploadJobSuccessHistogram, retry_, |
| 416 static_cast<int>(UploadJobSuccess::REQUEST_MAX)); |
| 416 delegate_->OnSuccess(); | 417 delegate_->OnSuccess(); |
| 417 } else if (response_code == net::HTTP_UNAUTHORIZED) { | 418 } else if (response_code == net::HTTP_UNAUTHORIZED) { |
| 418 SYSLOG(ERROR) << "Unauthorized request."; | 419 SYSLOG(ERROR) << "Unauthorized request."; |
| 419 HandleError(AUTHENTICATION_ERROR); | 420 HandleError(AUTHENTICATION_ERROR); |
| 420 } else { | 421 } else { |
| 421 SYSLOG(ERROR) << "POST request failed with HTTP status code " | 422 SYSLOG(ERROR) << "POST request failed with HTTP status code " |
| 422 << response_code << "."; | 423 << response_code << "."; |
| 423 HandleError(SERVER_ERROR); | 424 HandleError(SERVER_ERROR); |
| 424 } | 425 } |
| 425 } | 426 } |
| 426 } | 427 } |
| 427 | 428 |
| 428 } // namespace policy | 429 } // namespace policy |
| OLD | NEW |