OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_FAKE_DRIVE_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_DRIVE_FAKE_DRIVE_SERVICE_H_ |
6 #define CHROME_BROWSER_DRIVE_FAKE_DRIVE_SERVICE_H_ | 6 #define CHROME_BROWSER_DRIVE_FAKE_DRIVE_SERVICE_H_ |
7 | 7 |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "chrome/browser/drive/drive_service_interface.h" | 9 #include "chrome/browser/drive/drive_service_interface.h" |
10 | 10 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 static GURL GetFakeLinkUrl(const std::string& resource_id); | 120 static GURL GetFakeLinkUrl(const std::string& resource_id); |
121 | 121 |
122 // Sets the printf format for constructing the response of AuthorizeApp(). | 122 // Sets the printf format for constructing the response of AuthorizeApp(). |
123 // The format string must include two %s that are to be filled with | 123 // The format string must include two %s that are to be filled with |
124 // resource_id and app_id. | 124 // resource_id and app_id. |
125 void set_open_url_format(const std::string& url_format) { | 125 void set_open_url_format(const std::string& url_format) { |
126 open_url_format_ = url_format; | 126 open_url_format_ = url_format; |
127 } | 127 } |
128 | 128 |
129 // DriveServiceInterface Overrides | 129 // DriveServiceInterface Overrides |
130 virtual void Initialize(const std::string& account_id) OVERRIDE; | 130 virtual void Initialize(const std::string& account_id) override; |
131 virtual void AddObserver(DriveServiceObserver* observer) OVERRIDE; | 131 virtual void AddObserver(DriveServiceObserver* observer) override; |
132 virtual void RemoveObserver(DriveServiceObserver* observer) OVERRIDE; | 132 virtual void RemoveObserver(DriveServiceObserver* observer) override; |
133 virtual bool CanSendRequest() const OVERRIDE; | 133 virtual bool CanSendRequest() const override; |
134 virtual std::string GetRootResourceId() const OVERRIDE; | 134 virtual std::string GetRootResourceId() const override; |
135 virtual bool HasAccessToken() const OVERRIDE; | 135 virtual bool HasAccessToken() const override; |
136 virtual void RequestAccessToken( | 136 virtual void RequestAccessToken( |
137 const google_apis::AuthStatusCallback& callback) OVERRIDE; | 137 const google_apis::AuthStatusCallback& callback) override; |
138 virtual bool HasRefreshToken() const OVERRIDE; | 138 virtual bool HasRefreshToken() const override; |
139 virtual void ClearAccessToken() OVERRIDE; | 139 virtual void ClearAccessToken() override; |
140 virtual void ClearRefreshToken() OVERRIDE; | 140 virtual void ClearRefreshToken() override; |
141 virtual google_apis::CancelCallback GetAllFileList( | 141 virtual google_apis::CancelCallback GetAllFileList( |
142 const google_apis::FileListCallback& callback) OVERRIDE; | 142 const google_apis::FileListCallback& callback) override; |
143 virtual google_apis::CancelCallback GetFileListInDirectory( | 143 virtual google_apis::CancelCallback GetFileListInDirectory( |
144 const std::string& directory_resource_id, | 144 const std::string& directory_resource_id, |
145 const google_apis::FileListCallback& callback) OVERRIDE; | 145 const google_apis::FileListCallback& callback) override; |
146 // See the comment for EntryMatchWidthQuery() in .cc file for details about | 146 // See the comment for EntryMatchWidthQuery() in .cc file for details about |
147 // the supported search query types. | 147 // the supported search query types. |
148 virtual google_apis::CancelCallback Search( | 148 virtual google_apis::CancelCallback Search( |
149 const std::string& search_query, | 149 const std::string& search_query, |
150 const google_apis::FileListCallback& callback) OVERRIDE; | 150 const google_apis::FileListCallback& callback) override; |
151 virtual google_apis::CancelCallback SearchByTitle( | 151 virtual google_apis::CancelCallback SearchByTitle( |
152 const std::string& title, | 152 const std::string& title, |
153 const std::string& directory_resource_id, | 153 const std::string& directory_resource_id, |
154 const google_apis::FileListCallback& callback) OVERRIDE; | 154 const google_apis::FileListCallback& callback) override; |
155 virtual google_apis::CancelCallback GetChangeList( | 155 virtual google_apis::CancelCallback GetChangeList( |
156 int64 start_changestamp, | 156 int64 start_changestamp, |
157 const google_apis::ChangeListCallback& callback) OVERRIDE; | 157 const google_apis::ChangeListCallback& callback) override; |
158 virtual google_apis::CancelCallback GetRemainingChangeList( | 158 virtual google_apis::CancelCallback GetRemainingChangeList( |
159 const GURL& next_link, | 159 const GURL& next_link, |
160 const google_apis::ChangeListCallback& callback) OVERRIDE; | 160 const google_apis::ChangeListCallback& callback) override; |
161 virtual google_apis::CancelCallback GetRemainingFileList( | 161 virtual google_apis::CancelCallback GetRemainingFileList( |
162 const GURL& next_link, | 162 const GURL& next_link, |
163 const google_apis::FileListCallback& callback) OVERRIDE; | 163 const google_apis::FileListCallback& callback) override; |
164 virtual google_apis::CancelCallback GetFileResource( | 164 virtual google_apis::CancelCallback GetFileResource( |
165 const std::string& resource_id, | 165 const std::string& resource_id, |
166 const google_apis::FileResourceCallback& callback) OVERRIDE; | 166 const google_apis::FileResourceCallback& callback) override; |
167 virtual google_apis::CancelCallback GetShareUrl( | 167 virtual google_apis::CancelCallback GetShareUrl( |
168 const std::string& resource_id, | 168 const std::string& resource_id, |
169 const GURL& embed_origin, | 169 const GURL& embed_origin, |
170 const google_apis::GetShareUrlCallback& callback) OVERRIDE; | 170 const google_apis::GetShareUrlCallback& callback) override; |
171 virtual google_apis::CancelCallback GetAboutResource( | 171 virtual google_apis::CancelCallback GetAboutResource( |
172 const google_apis::AboutResourceCallback& callback) OVERRIDE; | 172 const google_apis::AboutResourceCallback& callback) override; |
173 virtual google_apis::CancelCallback GetAppList( | 173 virtual google_apis::CancelCallback GetAppList( |
174 const google_apis::AppListCallback& callback) OVERRIDE; | 174 const google_apis::AppListCallback& callback) override; |
175 virtual google_apis::CancelCallback DeleteResource( | 175 virtual google_apis::CancelCallback DeleteResource( |
176 const std::string& resource_id, | 176 const std::string& resource_id, |
177 const std::string& etag, | 177 const std::string& etag, |
178 const google_apis::EntryActionCallback& callback) OVERRIDE; | 178 const google_apis::EntryActionCallback& callback) override; |
179 virtual google_apis::CancelCallback TrashResource( | 179 virtual google_apis::CancelCallback TrashResource( |
180 const std::string& resource_id, | 180 const std::string& resource_id, |
181 const google_apis::EntryActionCallback& callback) OVERRIDE; | 181 const google_apis::EntryActionCallback& callback) override; |
182 virtual google_apis::CancelCallback DownloadFile( | 182 virtual google_apis::CancelCallback DownloadFile( |
183 const base::FilePath& local_cache_path, | 183 const base::FilePath& local_cache_path, |
184 const std::string& resource_id, | 184 const std::string& resource_id, |
185 const google_apis::DownloadActionCallback& download_action_callback, | 185 const google_apis::DownloadActionCallback& download_action_callback, |
186 const google_apis::GetContentCallback& get_content_callback, | 186 const google_apis::GetContentCallback& get_content_callback, |
187 const google_apis::ProgressCallback& progress_callback) OVERRIDE; | 187 const google_apis::ProgressCallback& progress_callback) override; |
188 virtual google_apis::CancelCallback CopyResource( | 188 virtual google_apis::CancelCallback CopyResource( |
189 const std::string& resource_id, | 189 const std::string& resource_id, |
190 const std::string& parent_resource_id, | 190 const std::string& parent_resource_id, |
191 const std::string& new_title, | 191 const std::string& new_title, |
192 const base::Time& last_modified, | 192 const base::Time& last_modified, |
193 const google_apis::FileResourceCallback& callback) OVERRIDE; | 193 const google_apis::FileResourceCallback& callback) override; |
194 virtual google_apis::CancelCallback UpdateResource( | 194 virtual google_apis::CancelCallback UpdateResource( |
195 const std::string& resource_id, | 195 const std::string& resource_id, |
196 const std::string& parent_resource_id, | 196 const std::string& parent_resource_id, |
197 const std::string& new_title, | 197 const std::string& new_title, |
198 const base::Time& last_modified, | 198 const base::Time& last_modified, |
199 const base::Time& last_viewed_by_me, | 199 const base::Time& last_viewed_by_me, |
200 const google_apis::FileResourceCallback& callback) OVERRIDE; | 200 const google_apis::FileResourceCallback& callback) override; |
201 virtual google_apis::CancelCallback AddResourceToDirectory( | 201 virtual google_apis::CancelCallback AddResourceToDirectory( |
202 const std::string& parent_resource_id, | 202 const std::string& parent_resource_id, |
203 const std::string& resource_id, | 203 const std::string& resource_id, |
204 const google_apis::EntryActionCallback& callback) OVERRIDE; | 204 const google_apis::EntryActionCallback& callback) override; |
205 virtual google_apis::CancelCallback RemoveResourceFromDirectory( | 205 virtual google_apis::CancelCallback RemoveResourceFromDirectory( |
206 const std::string& parent_resource_id, | 206 const std::string& parent_resource_id, |
207 const std::string& resource_id, | 207 const std::string& resource_id, |
208 const google_apis::EntryActionCallback& callback) OVERRIDE; | 208 const google_apis::EntryActionCallback& callback) override; |
209 virtual google_apis::CancelCallback AddNewDirectory( | 209 virtual google_apis::CancelCallback AddNewDirectory( |
210 const std::string& parent_resource_id, | 210 const std::string& parent_resource_id, |
211 const std::string& directory_title, | 211 const std::string& directory_title, |
212 const AddNewDirectoryOptions& options, | 212 const AddNewDirectoryOptions& options, |
213 const google_apis::FileResourceCallback& callback) OVERRIDE; | 213 const google_apis::FileResourceCallback& callback) override; |
214 virtual google_apis::CancelCallback InitiateUploadNewFile( | 214 virtual google_apis::CancelCallback InitiateUploadNewFile( |
215 const std::string& content_type, | 215 const std::string& content_type, |
216 int64 content_length, | 216 int64 content_length, |
217 const std::string& parent_resource_id, | 217 const std::string& parent_resource_id, |
218 const std::string& title, | 218 const std::string& title, |
219 const InitiateUploadNewFileOptions& options, | 219 const InitiateUploadNewFileOptions& options, |
220 const google_apis::InitiateUploadCallback& callback) OVERRIDE; | 220 const google_apis::InitiateUploadCallback& callback) override; |
221 virtual google_apis::CancelCallback InitiateUploadExistingFile( | 221 virtual google_apis::CancelCallback InitiateUploadExistingFile( |
222 const std::string& content_type, | 222 const std::string& content_type, |
223 int64 content_length, | 223 int64 content_length, |
224 const std::string& resource_id, | 224 const std::string& resource_id, |
225 const InitiateUploadExistingFileOptions& options, | 225 const InitiateUploadExistingFileOptions& options, |
226 const google_apis::InitiateUploadCallback& callback) OVERRIDE; | 226 const google_apis::InitiateUploadCallback& callback) override; |
227 virtual google_apis::CancelCallback ResumeUpload( | 227 virtual google_apis::CancelCallback ResumeUpload( |
228 const GURL& upload_url, | 228 const GURL& upload_url, |
229 int64 start_position, | 229 int64 start_position, |
230 int64 end_position, | 230 int64 end_position, |
231 int64 content_length, | 231 int64 content_length, |
232 const std::string& content_type, | 232 const std::string& content_type, |
233 const base::FilePath& local_file_path, | 233 const base::FilePath& local_file_path, |
234 const google_apis::drive::UploadRangeCallback& callback, | 234 const google_apis::drive::UploadRangeCallback& callback, |
235 const google_apis::ProgressCallback& progress_callback) OVERRIDE; | 235 const google_apis::ProgressCallback& progress_callback) override; |
236 virtual google_apis::CancelCallback GetUploadStatus( | 236 virtual google_apis::CancelCallback GetUploadStatus( |
237 const GURL& upload_url, | 237 const GURL& upload_url, |
238 int64 content_length, | 238 int64 content_length, |
239 const google_apis::drive::UploadRangeCallback& callback) OVERRIDE; | 239 const google_apis::drive::UploadRangeCallback& callback) override; |
240 virtual google_apis::CancelCallback AuthorizeApp( | 240 virtual google_apis::CancelCallback AuthorizeApp( |
241 const std::string& resource_id, | 241 const std::string& resource_id, |
242 const std::string& app_id, | 242 const std::string& app_id, |
243 const google_apis::AuthorizeAppCallback& callback) OVERRIDE; | 243 const google_apis::AuthorizeAppCallback& callback) override; |
244 virtual google_apis::CancelCallback UninstallApp( | 244 virtual google_apis::CancelCallback UninstallApp( |
245 const std::string& app_id, | 245 const std::string& app_id, |
246 const google_apis::EntryActionCallback& callback) OVERRIDE; | 246 const google_apis::EntryActionCallback& callback) override; |
247 virtual google_apis::CancelCallback AddPermission( | 247 virtual google_apis::CancelCallback AddPermission( |
248 const std::string& resource_id, | 248 const std::string& resource_id, |
249 const std::string& email, | 249 const std::string& email, |
250 google_apis::drive::PermissionRole role, | 250 google_apis::drive::PermissionRole role, |
251 const google_apis::EntryActionCallback& callback) OVERRIDE; | 251 const google_apis::EntryActionCallback& callback) override; |
252 | 252 |
253 // Adds a new file with the given parameters. On success, returns | 253 // Adds a new file with the given parameters. On success, returns |
254 // HTTP_CREATED with the parsed entry. | 254 // HTTP_CREATED with the parsed entry. |
255 // |callback| must not be null. | 255 // |callback| must not be null. |
256 void AddNewFile(const std::string& content_type, | 256 void AddNewFile(const std::string& content_type, |
257 const std::string& content_data, | 257 const std::string& content_data, |
258 const std::string& parent_resource_id, | 258 const std::string& parent_resource_id, |
259 const std::string& title, | 259 const std::string& title, |
260 bool shared_with_me, | 260 bool shared_with_me, |
261 const google_apis::FileResourceCallback& callback); | 261 const google_apis::FileResourceCallback& callback); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 ObserverList<ChangeObserver> change_observers_; | 371 ObserverList<ChangeObserver> change_observers_; |
372 | 372 |
373 base::WeakPtrFactory<FakeDriveService> weak_ptr_factory_; | 373 base::WeakPtrFactory<FakeDriveService> weak_ptr_factory_; |
374 | 374 |
375 DISALLOW_COPY_AND_ASSIGN(FakeDriveService); | 375 DISALLOW_COPY_AND_ASSIGN(FakeDriveService); |
376 }; | 376 }; |
377 | 377 |
378 } // namespace drive | 378 } // namespace drive |
379 | 379 |
380 #endif // CHROME_BROWSER_DRIVE_FAKE_DRIVE_SERVICE_H_ | 380 #endif // CHROME_BROWSER_DRIVE_FAKE_DRIVE_SERVICE_H_ |
OLD | NEW |