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

Side by Side Diff: chrome/browser/sync_file_system/drive_backend/drive_service_messenger.h

Issue 248853002: [NOCOMMIT] Make DriveService{Wrapper|Messenger} class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simplify Created 6 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef CHROME_BROWSER_DRIVE_DUMMY_DRIVE_SERVICE_H_ 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_DRIVE_SERVICE_MESSENGER_H_
6 #define CHROME_BROWSER_DRIVE_DUMMY_DRIVE_SERVICE_H_ 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_DRIVE_SERVICE_MESSENGER_H_
7 7
8 #include "base/memory/weak_ptr.h"
8 #include "chrome/browser/drive/drive_service_interface.h" 9 #include "chrome/browser/drive/drive_service_interface.h"
9 #include "google_apis/drive/auth_service_interface.h"
10 10
11 namespace drive { 11 namespace drive {
12 class DriveServiceObserver;
13 }
12 14
13 // Dummy implementation of DriveServiceInterface. 15 namespace sync_file_system {
14 // All functions do nothing, or return place holder values like 'true'. 16 namespace drive_backend {
15 class DummyDriveService : public DriveServiceInterface { 17
18 class DriveServiceWrapper;
19
20 // This class is a wrapper of drive::DriveServiceInterface class, and
21 // is used by SyncTaskManager. This class runs in a worker thread and posts
22 // tasks to UI thread.
23 class DriveServiceMessenger : public drive::DriveServiceInterface {
16 public: 24 public:
17 DummyDriveService(); 25 DriveServiceMessenger(const base::WeakPtr<DriveServiceWrapper>& wrapper);
18 virtual ~DummyDriveService(); 26 virtual ~DriveServiceMessenger();
19 27
20 // DriveServiceInterface Overrides 28 // Common service:
21 virtual void Initialize(const std::string& account_id) OVERRIDE; 29 virtual void Initialize(const std::string& account_id) OVERRIDE;
22 virtual void AddObserver(DriveServiceObserver* observer) OVERRIDE; 30 virtual void AddObserver(drive::DriveServiceObserver* observer) OVERRIDE;
23 virtual void RemoveObserver(DriveServiceObserver* observer) OVERRIDE; 31 virtual void RemoveObserver(drive::DriveServiceObserver* observer) OVERRIDE;
24 virtual bool CanSendRequest() const OVERRIDE; 32 virtual bool CanSendRequest() const OVERRIDE;
25 virtual ResourceIdCanonicalizer GetResourceIdCanonicalizer() const OVERRIDE; 33 virtual drive::ResourceIdCanonicalizer GetResourceIdCanonicalizer()
34 const OVERRIDE;
35
36 // Authentication service:
26 virtual bool HasAccessToken() const OVERRIDE; 37 virtual bool HasAccessToken() const OVERRIDE;
27 virtual void RequestAccessToken( 38 virtual void RequestAccessToken(
28 const google_apis::AuthStatusCallback& callback) OVERRIDE; 39 const google_apis::AuthStatusCallback& callback) OVERRIDE;
29 virtual bool HasRefreshToken() const OVERRIDE; 40 virtual bool HasRefreshToken() const OVERRIDE;
30 virtual void ClearAccessToken() OVERRIDE; 41 virtual void ClearAccessToken() OVERRIDE;
31 virtual void ClearRefreshToken() OVERRIDE; 42 virtual void ClearRefreshToken() OVERRIDE;
43
44 // Document access:
32 virtual std::string GetRootResourceId() const OVERRIDE; 45 virtual std::string GetRootResourceId() const OVERRIDE;
33 virtual google_apis::CancelCallback GetAllResourceList( 46 virtual google_apis::CancelCallback GetAllResourceList(
34 const google_apis::GetResourceListCallback& callback) OVERRIDE; 47 const google_apis::GetResourceListCallback& callback) OVERRIDE;
35 virtual google_apis::CancelCallback GetResourceListInDirectory( 48 virtual google_apis::CancelCallback GetResourceListInDirectory(
36 const std::string& directory_resource_id, 49 const std::string& directory_resource_id,
37 const google_apis::GetResourceListCallback& callback) OVERRIDE; 50 const google_apis::GetResourceListCallback& callback) OVERRIDE;
38 virtual google_apis::CancelCallback Search( 51 virtual google_apis::CancelCallback Search(
39 const std::string& search_query, 52 const std::string& search_query,
40 const google_apis::GetResourceListCallback& callback) OVERRIDE; 53 const google_apis::GetResourceListCallback& callback) OVERRIDE;
41 virtual google_apis::CancelCallback SearchByTitle( 54 virtual google_apis::CancelCallback SearchByTitle(
(...skipping 20 matching lines...) Expand all
62 const google_apis::AboutResourceCallback& callback) OVERRIDE; 75 const google_apis::AboutResourceCallback& callback) OVERRIDE;
63 virtual google_apis::CancelCallback GetAppList( 76 virtual google_apis::CancelCallback GetAppList(
64 const google_apis::AppListCallback& callback) OVERRIDE; 77 const google_apis::AppListCallback& callback) OVERRIDE;
65 virtual google_apis::CancelCallback DeleteResource( 78 virtual google_apis::CancelCallback DeleteResource(
66 const std::string& resource_id, 79 const std::string& resource_id,
67 const std::string& etag, 80 const std::string& etag,
68 const google_apis::EntryActionCallback& callback) OVERRIDE; 81 const google_apis::EntryActionCallback& callback) OVERRIDE;
69 virtual google_apis::CancelCallback TrashResource( 82 virtual google_apis::CancelCallback TrashResource(
70 const std::string& resource_id, 83 const std::string& resource_id,
71 const google_apis::EntryActionCallback& callback) OVERRIDE; 84 const google_apis::EntryActionCallback& callback) OVERRIDE;
72 virtual google_apis::CancelCallback DownloadFile(
73 const base::FilePath& local_cache_path,
74 const std::string& resource_id,
75 const google_apis::DownloadActionCallback& download_action_callback,
76 const google_apis::GetContentCallback& get_content_callback,
77 const google_apis::ProgressCallback& progress_callback) OVERRIDE;
78 virtual google_apis::CancelCallback CopyResource( 85 virtual google_apis::CancelCallback CopyResource(
79 const std::string& resource_id, 86 const std::string& resource_id,
80 const std::string& parent_resource_id, 87 const std::string& parent_resource_id,
81 const std::string& new_title, 88 const std::string& new_title,
82 const base::Time& last_modified, 89 const base::Time& last_modified,
83 const google_apis::GetResourceEntryCallback& callback) OVERRIDE; 90 const google_apis::GetResourceEntryCallback& callback) OVERRIDE;
84 virtual google_apis::CancelCallback UpdateResource( 91 virtual google_apis::CancelCallback UpdateResource(
85 const std::string& resource_id, 92 const std::string& resource_id,
86 const std::string& parent_resource_id, 93 const std::string& parent_resource_id,
87 const std::string& new_title, 94 const std::string& new_title,
(...skipping 10 matching lines...) Expand all
98 const google_apis::EntryActionCallback& callback) OVERRIDE; 105 const google_apis::EntryActionCallback& callback) OVERRIDE;
99 virtual google_apis::CancelCallback RemoveResourceFromDirectory( 106 virtual google_apis::CancelCallback RemoveResourceFromDirectory(
100 const std::string& parent_resource_id, 107 const std::string& parent_resource_id,
101 const std::string& resource_id, 108 const std::string& resource_id,
102 const google_apis::EntryActionCallback& callback) OVERRIDE; 109 const google_apis::EntryActionCallback& callback) OVERRIDE;
103 virtual google_apis::CancelCallback AddNewDirectory( 110 virtual google_apis::CancelCallback AddNewDirectory(
104 const std::string& parent_resource_id, 111 const std::string& parent_resource_id,
105 const std::string& directory_title, 112 const std::string& directory_title,
106 const AddNewDirectoryOptions& options, 113 const AddNewDirectoryOptions& options,
107 const google_apis::GetResourceEntryCallback& callback) OVERRIDE; 114 const google_apis::GetResourceEntryCallback& callback) OVERRIDE;
115 virtual google_apis::CancelCallback DownloadFile(
116 const base::FilePath& local_cache_path,
117 const std::string& resource_id,
118 const google_apis::DownloadActionCallback& download_action_callback,
119 const google_apis::GetContentCallback& get_content_callback,
120 const google_apis::ProgressCallback& progress_callback) OVERRIDE;
108 virtual google_apis::CancelCallback InitiateUploadNewFile( 121 virtual google_apis::CancelCallback InitiateUploadNewFile(
109 const std::string& content_type, 122 const std::string& content_type,
110 int64 content_length, 123 int64 content_length,
111 const std::string& parent_resource_id, 124 const std::string& parent_resource_id,
112 const std::string& title, 125 const std::string& title,
113 const InitiateUploadNewFileOptions& options, 126 const InitiateUploadNewFileOptions& options,
114 const google_apis::InitiateUploadCallback& callback) OVERRIDE; 127 const google_apis::InitiateUploadCallback& callback) OVERRIDE;
115 virtual google_apis::CancelCallback InitiateUploadExistingFile( 128 virtual google_apis::CancelCallback InitiateUploadExistingFile(
116 const std::string& content_type, 129 const std::string& content_type,
117 int64 content_length, 130 int64 content_length,
(...skipping 18 matching lines...) Expand all
136 const std::string& app_id, 149 const std::string& app_id,
137 const google_apis::AuthorizeAppCallback& callback) OVERRIDE; 150 const google_apis::AuthorizeAppCallback& callback) OVERRIDE;
138 virtual google_apis::CancelCallback UninstallApp( 151 virtual google_apis::CancelCallback UninstallApp(
139 const std::string& app_id, 152 const std::string& app_id,
140 const google_apis::EntryActionCallback& callback) OVERRIDE; 153 const google_apis::EntryActionCallback& callback) OVERRIDE;
141 virtual google_apis::CancelCallback AddPermission( 154 virtual google_apis::CancelCallback AddPermission(
142 const std::string& resource_id, 155 const std::string& resource_id,
143 const std::string& email, 156 const std::string& email,
144 google_apis::drive::PermissionRole role, 157 google_apis::drive::PermissionRole role,
145 const google_apis::EntryActionCallback& callback) OVERRIDE; 158 const google_apis::EntryActionCallback& callback) OVERRIDE;
159
160 drive::DriveServiceInterface* GetDriveService();
161
162 private:
163 base::WeakPtr<DriveServiceWrapper> wrapper_;
164
165 DISALLOW_COPY_AND_ASSIGN(DriveServiceMessenger);
146 }; 166 };
147 167
148 } // namespace drive 168 } // namespace drive_backend
169 } // namespace sync_file_system
149 170
150 #endif // CHROME_BROWSER_DRIVE_DUMMY_DRIVE_SERVICE_H_ 171 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_DRIVE_SERVICE_WRAPPER_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698