| 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 <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/rand_util.h" | 10 #include "base/rand_util.h" |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 LOG(ERROR) << "Unauthorized request."; | 381 LOG(ERROR) << "Unauthorized request."; |
| 382 state_ = ERROR; | 382 state_ = ERROR; |
| 383 post_data_.reset(); | 383 post_data_.reset(); |
| 384 delegate_->OnFailure(AUTHENTICATION_ERROR); | 384 delegate_->OnFailure(AUTHENTICATION_ERROR); |
| 385 return; | 385 return; |
| 386 } | 386 } |
| 387 retry_++; | 387 retry_++; |
| 388 upload_fetcher_.reset(); | 388 upload_fetcher_.reset(); |
| 389 OAuth2TokenService::ScopeSet scope_set; | 389 OAuth2TokenService::ScopeSet scope_set; |
| 390 scope_set.insert(GaiaConstants::kDeviceManagementServiceOAuth); | 390 scope_set.insert(GaiaConstants::kDeviceManagementServiceOAuth); |
| 391 token_service_->InvalidateToken(account_id_, scope_set, access_token_); | 391 token_service_->InvalidateAccessToken(account_id_, scope_set, |
| 392 access_token_); |
| 392 access_token_.clear(); | 393 access_token_.clear(); |
| 393 RequestAccessToken(); | 394 RequestAccessToken(); |
| 394 return; | 395 return; |
| 395 } | 396 } |
| 396 | 397 |
| 397 upload_fetcher_.reset(); | 398 upload_fetcher_.reset(); |
| 398 access_token_.clear(); | 399 access_token_.clear(); |
| 399 upload_fetcher_.reset(); | 400 upload_fetcher_.reset(); |
| 400 post_data_.reset(); | 401 post_data_.reset(); |
| 401 if (success) { | 402 if (success) { |
| 402 state_ = SUCCESS; | 403 state_ = SUCCESS; |
| 403 delegate_->OnSuccess(); | 404 delegate_->OnSuccess(); |
| 404 } else { | 405 } else { |
| 405 state_ = ERROR; | 406 state_ = ERROR; |
| 406 delegate_->OnFailure(SERVER_ERROR); | 407 delegate_->OnFailure(SERVER_ERROR); |
| 407 } | 408 } |
| 408 } | 409 } |
| 409 | 410 |
| 410 } // namespace policy | 411 } // namespace policy |
| OLD | NEW |