| 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_GOOGLE_APIS_FAKE_DRIVE_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_GOOGLE_APIS_FAKE_DRIVE_SERVICE_H_ |
| 6 #define CHROME_BROWSER_GOOGLE_APIS_FAKE_DRIVE_SERVICE_H_ | 6 #define CHROME_BROWSER_GOOGLE_APIS_FAKE_DRIVE_SERVICE_H_ |
| 7 | 7 |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/google_apis/drive_service_interface.h" | 9 #include "chrome/browser/google_apis/drive_service_interface.h" |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 public: | 22 public: |
| 23 FakeDriveService(); | 23 FakeDriveService(); |
| 24 virtual ~FakeDriveService(); | 24 virtual ~FakeDriveService(); |
| 25 | 25 |
| 26 // Loads the resource list for WAPI. Returns true on success. | 26 // Loads the resource list for WAPI. Returns true on success. |
| 27 bool LoadResourceListForWapi(const std::string& relative_path); | 27 bool LoadResourceListForWapi(const std::string& relative_path); |
| 28 | 28 |
| 29 // Loads the account metadata for WAPI. Returns true on success. | 29 // Loads the account metadata for WAPI. Returns true on success. |
| 30 bool LoadAccountMetadataForWapi(const std::string& relative_path); | 30 bool LoadAccountMetadataForWapi(const std::string& relative_path); |
| 31 | 31 |
| 32 // Loads the application info for Drive API. Returns true on success. |
| 33 bool LoadApplicationInfoForDriveApi(const std::string& relative_path); |
| 34 |
| 32 // DriveServiceInterface Overrides | 35 // DriveServiceInterface Overrides |
| 33 virtual void Initialize(Profile* profile) OVERRIDE; | 36 virtual void Initialize(Profile* profile) OVERRIDE; |
| 34 virtual void AddObserver(DriveServiceObserver* observer) OVERRIDE; | 37 virtual void AddObserver(DriveServiceObserver* observer) OVERRIDE; |
| 35 virtual void RemoveObserver(DriveServiceObserver* observer) OVERRIDE; | 38 virtual void RemoveObserver(DriveServiceObserver* observer) OVERRIDE; |
| 36 virtual bool CanStartOperation() const OVERRIDE; | 39 virtual bool CanStartOperation() const OVERRIDE; |
| 37 virtual void CancelAll() OVERRIDE; | 40 virtual void CancelAll() OVERRIDE; |
| 38 virtual bool CancelForFilePath(const FilePath& file_path) OVERRIDE; | 41 virtual bool CancelForFilePath(const FilePath& file_path) OVERRIDE; |
| 39 virtual OperationProgressStatusList GetProgressStatusList() const OVERRIDE; | 42 virtual OperationProgressStatusList GetProgressStatusList() const OVERRIDE; |
| 40 virtual bool HasAccessToken() const OVERRIDE; | 43 virtual bool HasAccessToken() const OVERRIDE; |
| 41 virtual bool HasRefreshToken() const OVERRIDE; | 44 virtual bool HasRefreshToken() const OVERRIDE; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 59 const FilePath& local_cache_path, | 62 const FilePath& local_cache_path, |
| 60 const GURL& content_url, | 63 const GURL& content_url, |
| 61 DocumentExportFormat format, | 64 DocumentExportFormat format, |
| 62 const DownloadActionCallback& callback) OVERRIDE; | 65 const DownloadActionCallback& callback) OVERRIDE; |
| 63 virtual void DownloadFile( | 66 virtual void DownloadFile( |
| 64 const FilePath& virtual_path, | 67 const FilePath& virtual_path, |
| 65 const FilePath& local_cache_path, | 68 const FilePath& local_cache_path, |
| 66 const GURL& content_url, | 69 const GURL& content_url, |
| 67 const DownloadActionCallback& download_action_callback, | 70 const DownloadActionCallback& download_action_callback, |
| 68 const GetContentCallback& get_content_callback) OVERRIDE; | 71 const GetContentCallback& get_content_callback) OVERRIDE; |
| 72 // The new resource ID for the copied document will look like |
| 73 // |resource_id| + "_copied". |
| 69 virtual void CopyHostedDocument( | 74 virtual void CopyHostedDocument( |
| 70 const std::string& resource_id, | 75 const std::string& resource_id, |
| 71 const FilePath::StringType& new_name, | 76 const FilePath::StringType& new_name, |
| 72 const GetResourceEntryCallback& callback) OVERRIDE; | 77 const GetResourceEntryCallback& callback) OVERRIDE; |
| 73 virtual void RenameResource(const GURL& edit_url, | 78 virtual void RenameResource(const GURL& edit_url, |
| 74 const FilePath::StringType& new_name, | 79 const FilePath::StringType& new_name, |
| 75 const EntryActionCallback& callback) OVERRIDE; | 80 const EntryActionCallback& callback) OVERRIDE; |
| 76 virtual void AddResourceToDirectory( | 81 virtual void AddResourceToDirectory( |
| 77 const GURL& parent_content_url, | 82 const GURL& parent_content_url, |
| 78 const GURL& edit_url, | 83 const GURL& edit_url, |
| 79 const EntryActionCallback& callback) OVERRIDE; | 84 const EntryActionCallback& callback) OVERRIDE; |
| 80 virtual void RemoveResourceFromDirectory( | 85 virtual void RemoveResourceFromDirectory( |
| 81 const GURL& parent_content_url, | 86 const GURL& parent_content_url, |
| 82 const std::string& resource_id, | 87 const std::string& resource_id, |
| 83 const EntryActionCallback& callback) OVERRIDE; | 88 const EntryActionCallback& callback) OVERRIDE; |
| 84 virtual void AddNewDirectory( | 89 virtual void AddNewDirectory( |
| 85 const GURL& parent_content_url, | 90 const GURL& parent_content_url, |
| 86 const FilePath::StringType& directory_name, | 91 const FilePath::StringType& directory_name, |
| 87 const GetResourceEntryCallback& callback) OVERRIDE; | 92 const GetResourceEntryCallback& callback) OVERRIDE; |
| 88 virtual void InitiateUpload(const InitiateUploadParams& params, | 93 virtual void InitiateUpload(const InitiateUploadParams& params, |
| 89 const InitiateUploadCallback& callback) OVERRIDE; | 94 const InitiateUploadCallback& callback) OVERRIDE; |
| 90 virtual void ResumeUpload(const ResumeUploadParams& params, | 95 virtual void ResumeUpload(const ResumeUploadParams& params, |
| 91 const ResumeUploadCallback& callback) OVERRIDE; | 96 const ResumeUploadCallback& callback) OVERRIDE; |
| 92 virtual void AuthorizeApp(const GURL& edit_url, | 97 virtual void AuthorizeApp(const GURL& edit_url, |
| 93 const std::string& app_id, | 98 const std::string& app_id, |
| 94 const AuthorizeAppCallback& callback) OVERRIDE; | 99 const AuthorizeAppCallback& callback) OVERRIDE; |
| 95 | 100 |
| 96 private: | 101 private: |
| 102 // Returns a pointer to the entry that matches |resource_id|, or NULL if |
| 103 // not found. |
| 104 base::DictionaryValue* FindEntryByResourceId(const std::string& resource_id); |
| 105 |
| 106 // Returns a pointer to the entry that matches |edit_url|, or NULL if not |
| 107 // found. |
| 108 base::DictionaryValue* FindEntryByEditUrl(const GURL& edit_url); |
| 109 |
| 110 // Returns a pointer to the entry that matches |content_url|, or NULL if |
| 111 // not found. |
| 112 base::DictionaryValue* FindEntryByContentUrl(const GURL& content_url); |
| 113 |
| 114 // Returns a new resource ID, which looks like "resource_id_<num>" where |
| 115 // <num> is a monotonically increasing number starting from 1. |
| 116 std::string GetNewResourceId(); |
| 117 |
| 97 scoped_ptr<base::Value> resource_list_value_; | 118 scoped_ptr<base::Value> resource_list_value_; |
| 98 scoped_ptr<base::Value> account_metadata_value_; | 119 scoped_ptr<base::Value> account_metadata_value_; |
| 120 scoped_ptr<base::Value> app_info_value_; |
| 121 int resource_id_count_; |
| 122 |
| 99 DISALLOW_COPY_AND_ASSIGN(FakeDriveService); | 123 DISALLOW_COPY_AND_ASSIGN(FakeDriveService); |
| 100 }; | 124 }; |
| 101 | 125 |
| 102 } // namespace google_apis | 126 } // namespace google_apis |
| 103 | 127 |
| 104 #endif // CHROME_BROWSER_GOOGLE_APIS_FAKE_DRIVE_SERVICE_H_ | 128 #endif // CHROME_BROWSER_GOOGLE_APIS_FAKE_DRIVE_SERVICE_H_ |
| OLD | NEW |