Index: chrome/browser/sync_file_system/drive_backend/drive_service_messenger.h |
diff --git a/chrome/browser/drive/dummy_drive_service.h b/chrome/browser/sync_file_system/drive_backend/drive_service_messenger.h |
similarity index 82% |
copy from chrome/browser/drive/dummy_drive_service.h |
copy to chrome/browser/sync_file_system/drive_backend/drive_service_messenger.h |
index ce6ee94ed809acaa4f898e0c2e78f591e4522157..f5c6301db7bbec71aef56c297829178b36ad33bb 100644 |
--- a/chrome/browser/drive/dummy_drive_service.h |
+++ b/chrome/browser/sync_file_system/drive_backend/drive_service_messenger.h |
@@ -1,34 +1,47 @@ |
-// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef CHROME_BROWSER_DRIVE_DUMMY_DRIVE_SERVICE_H_ |
-#define CHROME_BROWSER_DRIVE_DUMMY_DRIVE_SERVICE_H_ |
+#ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_DRIVE_SERVICE_MESSENGER_H_ |
+#define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_DRIVE_SERVICE_MESSENGER_H_ |
+#include "base/memory/weak_ptr.h" |
#include "chrome/browser/drive/drive_service_interface.h" |
-#include "google_apis/drive/auth_service_interface.h" |
namespace drive { |
+class DriveServiceObserver; |
+} |
-// Dummy implementation of DriveServiceInterface. |
-// All functions do nothing, or return place holder values like 'true'. |
-class DummyDriveService : public DriveServiceInterface { |
+namespace sync_file_system { |
+namespace drive_backend { |
+ |
+class DriveServiceWrapper; |
+ |
+// This class is a wrapper of drive::DriveServiceInterface class, and |
+// is used by SyncTaskManager. This class runs in a worker thread and posts |
+// tasks to UI thread. |
+class DriveServiceMessenger : public drive::DriveServiceInterface { |
public: |
- DummyDriveService(); |
- virtual ~DummyDriveService(); |
+ DriveServiceMessenger(const base::WeakPtr<DriveServiceWrapper>& wrapper); |
+ virtual ~DriveServiceMessenger(); |
- // DriveServiceInterface Overrides |
+ // Common service: |
virtual void Initialize(const std::string& account_id) OVERRIDE; |
- virtual void AddObserver(DriveServiceObserver* observer) OVERRIDE; |
- virtual void RemoveObserver(DriveServiceObserver* observer) OVERRIDE; |
+ virtual void AddObserver(drive::DriveServiceObserver* observer) OVERRIDE; |
+ virtual void RemoveObserver(drive::DriveServiceObserver* observer) OVERRIDE; |
virtual bool CanSendRequest() const OVERRIDE; |
- virtual ResourceIdCanonicalizer GetResourceIdCanonicalizer() const OVERRIDE; |
+ virtual drive::ResourceIdCanonicalizer GetResourceIdCanonicalizer() |
+ const OVERRIDE; |
+ |
+ // Authentication service: |
virtual bool HasAccessToken() const OVERRIDE; |
virtual void RequestAccessToken( |
const google_apis::AuthStatusCallback& callback) OVERRIDE; |
virtual bool HasRefreshToken() const OVERRIDE; |
virtual void ClearAccessToken() OVERRIDE; |
virtual void ClearRefreshToken() OVERRIDE; |
+ |
+ // Document access: |
virtual std::string GetRootResourceId() const OVERRIDE; |
virtual google_apis::CancelCallback GetAllResourceList( |
const google_apis::GetResourceListCallback& callback) OVERRIDE; |
@@ -69,12 +82,6 @@ class DummyDriveService : public DriveServiceInterface { |
virtual google_apis::CancelCallback TrashResource( |
const std::string& resource_id, |
const google_apis::EntryActionCallback& callback) OVERRIDE; |
- virtual google_apis::CancelCallback DownloadFile( |
- const base::FilePath& local_cache_path, |
- const std::string& resource_id, |
- const google_apis::DownloadActionCallback& download_action_callback, |
- const google_apis::GetContentCallback& get_content_callback, |
- const google_apis::ProgressCallback& progress_callback) OVERRIDE; |
virtual google_apis::CancelCallback CopyResource( |
const std::string& resource_id, |
const std::string& parent_resource_id, |
@@ -105,6 +112,12 @@ class DummyDriveService : public DriveServiceInterface { |
const std::string& directory_title, |
const AddNewDirectoryOptions& options, |
const google_apis::GetResourceEntryCallback& callback) OVERRIDE; |
+ virtual google_apis::CancelCallback DownloadFile( |
+ const base::FilePath& local_cache_path, |
+ const std::string& resource_id, |
+ const google_apis::DownloadActionCallback& download_action_callback, |
+ const google_apis::GetContentCallback& get_content_callback, |
+ const google_apis::ProgressCallback& progress_callback) OVERRIDE; |
virtual google_apis::CancelCallback InitiateUploadNewFile( |
const std::string& content_type, |
int64 content_length, |
@@ -143,8 +156,16 @@ class DummyDriveService : public DriveServiceInterface { |
const std::string& email, |
google_apis::drive::PermissionRole role, |
const google_apis::EntryActionCallback& callback) OVERRIDE; |
+ |
+ drive::DriveServiceInterface* GetDriveService(); |
+ |
+ private: |
+ base::WeakPtr<DriveServiceWrapper> wrapper_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(DriveServiceMessenger); |
}; |
-} // namespace drive |
+} // namespace drive_backend |
+} // namespace sync_file_system |
-#endif // CHROME_BROWSER_DRIVE_DUMMY_DRIVE_SERVICE_H_ |
+#endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_DRIVE_SERVICE_WRAPPER_H_ |