Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1862)

Unified Diff: chrome/browser/chromeos/gdata/gdata_wapi_service.cc

Issue 10939011: Reland "Revert 156830 - drive: Stop exposing operation_registry() from DriveServiceInterface" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/gdata/gdata_wapi_service.cc
diff --git a/chrome/browser/chromeos/gdata/gdata_wapi_service.cc b/chrome/browser/chromeos/gdata/gdata_wapi_service.cc
index f031f49cc3ac58ef14bdc2a53b1ccc0c26603556..5d2165d6239749c1f9f23c578bee2fba05f4c97a 100644
--- a/chrome/browser/chromeos/gdata/gdata_wapi_service.cc
+++ b/chrome/browser/chromeos/gdata/gdata_wapi_service.cc
@@ -74,8 +74,10 @@ GDataWapiService::GDataWapiService()
GDataWapiService::~GDataWapiService() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- if (runner_.get())
+ if (runner_.get()) {
+ runner_->operation_registry()->RemoveObserver(this);
runner_->auth_service()->RemoveObserver(this);
+ }
}
AuthService* GDataWapiService::auth_service_for_testing() {
@@ -96,6 +98,7 @@ void GDataWapiService::Initialize(Profile* profile) {
runner_->Initialize();
runner_->auth_service()->AddObserver(this);
+ runner_->operation_registry()->AddObserver(this);
}
void GDataWapiService::AddObserver(DriveServiceObserver* observer) {
@@ -106,10 +109,6 @@ void GDataWapiService::RemoveObserver(DriveServiceObserver* observer) {
observers_.RemoveObserver(observer);
}
-OperationRegistry* GDataWapiService::operation_registry() const {
- return runner_->operation_registry();
-}
-
bool GDataWapiService::CanStartOperation() const {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
@@ -121,6 +120,16 @@ void GDataWapiService::CancelAll() {
runner_->CancelAll();
}
+bool GDataWapiService::CancelForFilePath(const FilePath& file_path) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ return operation_registry()->CancelForFilePath(file_path);
+}
+
+OperationProgressStatusList GDataWapiService::GetProgressStatusList() const {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ return operation_registry()->GetProgressStatusList();
+}
+
void GDataWapiService::Authenticate(const AuthStatusCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
runner_->Authenticate(callback);
@@ -314,6 +323,10 @@ bool GDataWapiService::HasRefreshToken() const {
return runner_->auth_service()->HasRefreshToken();
}
+OperationRegistry* GDataWapiService::operation_registry() const {
+ return runner_->operation_registry();
+}
+
void GDataWapiService::OnOAuth2RefreshTokenChanged() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
if (CanStartOperation()) {
@@ -322,4 +335,17 @@ void GDataWapiService::OnOAuth2RefreshTokenChanged() {
}
}
+void GDataWapiService::OnProgressUpdate(
+ const OperationProgressStatusList& list) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ FOR_EACH_OBSERVER(
+ DriveServiceObserver, observers_, OnProgressUpdate(list));
+}
+
+void GDataWapiService::OnAuthenticationFailed() {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ FOR_EACH_OBSERVER(
+ DriveServiceObserver, observers_, OnAuthenticationFailed());
+}
+
} // namespace gdata
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_wapi_service.h ('k') | chrome/browser/chromeos/gdata/mock_drive_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698