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

Unified Diff: chrome/browser/chromeos/gdata/drive_api_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/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
« no previous file with comments | « chrome/browser/chromeos/gdata/drive_api_service.h ('k') | chrome/browser/chromeos/gdata/drive_protocol_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698