| 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 std::unique_ptr<DataSegment> data_segment( | 162 std::unique_ptr<DataSegment> data_segment( |
| 163 new DataSegment(name, filename, std::move(data), header_entries)); | 163 new DataSegment(name, filename, std::move(data), header_entries)); |
| 164 data_segments_.push_back(std::move(data_segment)); | 164 data_segments_.push_back(std::move(data_segment)); |
| 165 } | 165 } |
| 166 | 166 |
| 167 void UploadJobImpl::Start() { | 167 void UploadJobImpl::Start() { |
| 168 // Cannot start an upload on a busy or failed instance. | 168 // Cannot start an upload on a busy or failed instance. |
| 169 DCHECK_EQ(IDLE, state_); | 169 DCHECK_EQ(IDLE, state_); |
| 170 if (state_ != IDLE) | 170 if (state_ != IDLE) |
| 171 return; | 171 return; |
| 172 LOG(WARNING) << "Upload job started"; |
| 172 RequestAccessToken(); | 173 RequestAccessToken(); |
| 173 } | 174 } |
| 174 | 175 |
| 175 void UploadJobImpl::RequestAccessToken() { | 176 void UploadJobImpl::RequestAccessToken() { |
| 176 state_ = ACQUIRING_TOKEN; | 177 state_ = ACQUIRING_TOKEN; |
| 177 | 178 |
| 178 OAuth2TokenService::ScopeSet scope_set; | 179 OAuth2TokenService::ScopeSet scope_set; |
| 179 scope_set.insert(GaiaConstants::kDeviceManagementServiceOAuth); | 180 scope_set.insert(GaiaConstants::kDeviceManagementServiceOAuth); |
| 180 access_token_request_ = | 181 access_token_request_ = |
| 181 token_service_->StartRequest(account_id_, scope_set, this); | 182 token_service_->StartRequest(account_id_, scope_set, this); |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 if (success) { | 343 if (success) { |
| 343 state_ = SUCCESS; | 344 state_ = SUCCESS; |
| 344 delegate_->OnSuccess(); | 345 delegate_->OnSuccess(); |
| 345 } else { | 346 } else { |
| 346 state_ = ERROR; | 347 state_ = ERROR; |
| 347 delegate_->OnFailure(SERVER_ERROR); | 348 delegate_->OnFailure(SERVER_ERROR); |
| 348 } | 349 } |
| 349 } | 350 } |
| 350 | 351 |
| 351 } // namespace policy | 352 } // namespace policy |
| OLD | NEW |