| 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 "chrome/browser/chromeos/gdata/operation_runner.h" | 5 #include "chrome/browser/chromeos/gdata/operation_runner.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "chrome/browser/chromeos/gdata/gdata_operations.h" | 8 #include "chrome/browser/chromeos/gdata/gdata_operations.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 weak_ptr_factory_.GetWeakPtr(), | 64 weak_ptr_factory_.GetWeakPtr(), |
| 65 operation)); | 65 operation)); |
| 66 return; | 66 return; |
| 67 } | 67 } |
| 68 | 68 |
| 69 operation->Start(auth_service_->access_token()); | 69 operation->Start(auth_service_->access_token()); |
| 70 } | 70 } |
| 71 | 71 |
| 72 void OperationRunner::OnOperationAuthRefresh( | 72 void OperationRunner::OnOperationAuthRefresh( |
| 73 GDataOperationInterface* operation, | 73 GDataOperationInterface* operation, |
| 74 GDataErrorCode code, | 74 DriveErrorCode code, |
| 75 const std::string& auth_token) { | 75 const std::string& auth_token) { |
| 76 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 76 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 77 | 77 |
| 78 if (code == HTTP_SUCCESS) { | 78 if (code == HTTP_SUCCESS) { |
| 79 DCHECK(auth_service_->HasRefreshToken()); | 79 DCHECK(auth_service_->HasRefreshToken()); |
| 80 StartOperation(operation); | 80 StartOperation(operation); |
| 81 } else { | 81 } else { |
| 82 operation->OnAuthFailed(code); | 82 operation->OnAuthFailed(code); |
| 83 } | 83 } |
| 84 } | 84 } |
| 85 | 85 |
| 86 void OperationRunner::RetryOperation(GDataOperationInterface* operation) { | 86 void OperationRunner::RetryOperation(GDataOperationInterface* operation) { |
| 87 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 87 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 88 | 88 |
| 89 auth_service_->ClearAccessToken(); | 89 auth_service_->ClearAccessToken(); |
| 90 // User authentication might have expired - rerun the request to force | 90 // User authentication might have expired - rerun the request to force |
| 91 // auth token refresh. | 91 // auth token refresh. |
| 92 StartOperation(operation); | 92 StartOperation(operation); |
| 93 } | 93 } |
| 94 | 94 |
| 95 void OperationRunner::OnOAuth2RefreshTokenChanged() { | 95 void OperationRunner::OnOAuth2RefreshTokenChanged() { |
| 96 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 96 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 97 } | 97 } |
| 98 | 98 |
| 99 } // namespace gdata | 99 } // namespace gdata |
| OLD | NEW |