Index: chrome/browser/chromeos/gdata/drive_api_service.cc |
diff --git a/chrome/browser/chromeos/gdata/drive_api_service.cc b/chrome/browser/chromeos/gdata/drive_api_service.cc |
index bdb082f231829a524a8a9902ac1b21cd18aa323f..e51678ae29ba37ee56e18030700b0eaa519a7c09 100644 |
--- a/chrome/browser/chromeos/gdata/drive_api_service.cc |
+++ b/chrome/browser/chromeos/gdata/drive_api_service.cc |
@@ -38,8 +38,10 @@ DriveAPIService::DriveAPIService() |
DriveAPIService::~DriveAPIService() { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
- if (runner_.get()) |
+ if (runner_.get()) { |
+ runner_->operation_registry()->RemoveObserver(this); |
runner_->auth_service()->RemoveObserver(this); |
+ } |
} |
void DriveAPIService::Initialize(Profile* profile) { |
@@ -53,6 +55,7 @@ void DriveAPIService::Initialize(Profile* profile) { |
runner_->Initialize(); |
runner_->auth_service()->AddObserver(this); |
+ runner_->operation_registry()->AddObserver(this); |
} |
void DriveAPIService::AddObserver(DriveServiceObserver* observer) { |
@@ -63,10 +66,6 @@ void DriveAPIService::RemoveObserver(DriveServiceObserver* observer) { |
observers_.RemoveObserver(observer); |
} |
-OperationRegistry* DriveAPIService::operation_registry() const { |
- return runner_->operation_registry(); |
-} |
- |
bool DriveAPIService::CanStartOperation() const { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
@@ -78,6 +77,16 @@ void DriveAPIService::CancelAll() { |
runner_->CancelAll(); |
} |
+bool DriveAPIService::CancelForFilePath(const FilePath& file_path) { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ return operation_registry()->CancelForFilePath(file_path); |
+} |
+ |
+OperationProgressStatusList DriveAPIService::GetProgressStatusList() const { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ return operation_registry()->GetProgressStatusList(); |
+} |
+ |
void DriveAPIService::Authenticate(const AuthStatusCallback& callback) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
runner_->Authenticate(callback); |
@@ -265,6 +274,10 @@ bool DriveAPIService::HasRefreshToken() const { |
return runner_->auth_service()->HasRefreshToken(); |
} |
+OperationRegistry* DriveAPIService::operation_registry() const { |
+ return runner_->operation_registry(); |
+} |
+ |
void DriveAPIService::OnOAuth2RefreshTokenChanged() { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
if (CanStartOperation()) { |
@@ -273,4 +286,17 @@ void DriveAPIService::OnOAuth2RefreshTokenChanged() { |
} |
} |
+void DriveAPIService::OnProgressUpdate( |
+ const OperationProgressStatusList& list) { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ FOR_EACH_OBSERVER( |
+ DriveServiceObserver, observers_, OnProgressUpdate(list)); |
+} |
+ |
+void DriveAPIService::OnAuthenticationFailed() { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ FOR_EACH_OBSERVER( |
+ DriveServiceObserver, observers_, OnAuthenticationFailed()); |
+} |
+ |
} // namespace gdata |