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

Side by Side Diff: chrome/browser/chromeos/gdata/documents_service_interface.h

Issue 10828385: Rename DocumentsServiceInterface to DriveServiceInterface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unnecessary includes. Created 8 years, 4 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_DOCUMENTS_SERVICE_INTERFACE_H_
6 #define CHROME_BROWSER_CHROMEOS_GDATA_DOCUMENTS_SERVICE_INTERFACE_H_
7
8 #include "chrome/browser/chromeos/gdata/operations_base.h"
9 // TODO(kochi): Further split gdata_operations.h and include only necessary
10 // headers. http://crbug.com/141469
11 #include "chrome/browser/chromeos/gdata/gdata_operations.h"
12
13 class Profile;
14
15 namespace gdata {
16
17 class GDataOperationRegistry;
18
19 // Document export format.
20 enum DocumentExportFormat {
21 PDF, // Portable Document Format. (all documents)
22 PNG, // Portable Networks Graphic Image Format (all documents)
23 HTML, // HTML Format (text documents and spreadsheets).
24 TXT, // Text file (text documents and presentations).
25 DOC, // Word (text documents only).
26 ODT, // Open Document Format (text documents only).
27 RTF, // Rich Text Format (text documents only).
28 ZIP, // ZIP archive (text documents only). Contains the images (if any)
29 // used in the document as well as a .html file containing the
30 // document's text.
31 JPEG, // JPEG (drawings only).
32 SVG, // Scalable Vector Graphics Image Format (drawings only).
33 PPT, // Powerpoint (presentations only).
34 XLS, // Excel (spreadsheets only).
35 CSV, // Excel (spreadsheets only).
36 ODS, // Open Document Spreadsheet (spreadsheets only).
37 TSV, // Tab Separated Value (spreadsheets only). Only the first worksheet
38 // is returned in TSV by default.
39 };
40
41 // This defines an interface for sharing by DocumentService and
42 // MockDocumentService so that we can do testing of clients of DocumentService.
43 //
44 // All functions must be called on UI thread. DocumentService is built on top
45 // of URLFetcher that runs on UI thread.
46 //
47 // TODO(zel,benchan): Make the terminology/naming convention (e.g. file vs
48 // document vs resource, directory vs collection) more consistent and precise.
49 // TODO(kochi): Rename this to DriveServiceInterface. http://crbug.com/143661.
50 class DocumentsServiceInterface {
51 public:
52 virtual ~DocumentsServiceInterface() {}
53
54 // Common service:
55
56 // Initializes the documents service tied with |profile|.
57 virtual void Initialize(Profile* profile) = 0;
58
59 // Retrieves the operation registry.
60 virtual GDataOperationRegistry* operation_registry() const = 0;
61
62 // Cancels all in-flight operations.
63 virtual void CancelAll() = 0;
64
65 // Authentication service:
66
67 // Authenticates the user by fetching the auth token as
68 // needed. |callback| will be run with the error code and the auth
69 // token, on the thread this function is run.
70 virtual void Authenticate(const AuthStatusCallback& callback) = 0;
71
72 // True if OAuth2 access token is retrieved and believed to be fresh.
73 virtual bool HasAccessToken() const = 0;
74
75 // True if OAuth2 refresh token is present.
76 virtual bool HasRefreshToken() const = 0;
77
78 // Document access:
79
80 // Fetches the document feed from |feed_url| with |start_changestamp|. If this
81 // URL is empty, the call will fetch the default root or change document feed.
82 // |start_changestamp| specifies the starting point from change feeds only.
83 // Value different than 0, it would trigger delta feed fetching.
84 //
85 // |search_query| specifies search query to be sent to the server. It will be
86 // used only if |start_changestamp| is 0. If empty string is passed,
87 // |search_query| is ignored.
88 //
89 // |directory_resource_id| specifies the directory from which documents are
90 // fetched. It will be used only if |start_changestamp| is 0. If empty
91 // string is passed, |directory_resource_id| is ignored.
92 //
93 // Upon completion, invokes |callback| with results on the calling thread.
94 // TODO(satorux): Refactor this function: crbug.com/128746
95 virtual void GetDocuments(const GURL& feed_url,
96 int64 start_changestamp,
97 const std::string& search_query,
98 const std::string& directory_resource_id,
99 const GetDataCallback& callback) = 0;
100
101 // Fetches single entry metadata from server. The entry's resource id equals
102 // |resource_id|.
103 // Upon completion, invokes |callback| with results on the calling thread.
104 virtual void GetDocumentEntry(const std::string& resource_id,
105 const GetDataCallback& callback) = 0;
106
107 // Gets the account metadata from the server using the default account
108 // metadata URL. Upon completion, invokes |callback| with results on the
109 // calling thread.
110 virtual void GetAccountMetadata(const GetDataCallback& callback) = 0;
111
112 // Gets the application information from the server.
113 // Upon completion, invokes |callback| with results on the calling thread.
114 virtual void GetApplicationInfo(const GetDataCallback& callback) = 0;
115
116 // Deletes a document identified by its 'self' |url| and |etag|.
117 // Upon completion, invokes |callback| with results on the calling thread.
118 virtual void DeleteDocument(const GURL& document_url,
119 const EntryActionCallback& callback) = 0;
120
121 // Downloads a document identified by its |content_url| in a given |format|.
122 // Upon completion, invokes |callback| with results on the calling thread.
123 virtual void DownloadDocument(const FilePath& virtual_path,
124 const FilePath& local_cache_path,
125 const GURL& content_url,
126 DocumentExportFormat format,
127 const DownloadActionCallback& callback) = 0;
128
129 // Makes a copy of a document identified by its |resource_id|.
130 // The copy is named as the UTF-8 encoded |new_name| and is not added to any
131 // collection. Use AddResourceToDirectory() to add the copy to a collection
132 // when needed. Upon completion, invokes |callback| with results on the
133 // calling thread.
134 virtual void CopyDocument(const std::string& resource_id,
135 const FilePath::StringType& new_name,
136 const GetDataCallback& callback) = 0;
137
138 // Renames a document or collection identified by its 'self' link
139 // |document_url| to the UTF-8 encoded |new_name|. Upon completion,
140 // invokes |callback| with results on the calling thread.
141 virtual void RenameResource(const GURL& resource_url,
142 const FilePath::StringType& new_name,
143 const EntryActionCallback& callback) = 0;
144
145 // Adds a resource (document, file, or collection) identified by its
146 // 'self' link |resource_url| to a collection with a content link
147 // |parent_content_url|. Upon completion, invokes |callback| with
148 // results on the calling thread.
149 virtual void AddResourceToDirectory(const GURL& parent_content_url,
150 const GURL& resource_url,
151 const EntryActionCallback& callback) = 0;
152
153 // Removes a resource (document, file, collection) identified by its
154 // 'self' link |resource_url| from a collection with a content link
155 // |parent_content_url|. Upon completion, invokes |callback| with
156 // results on the calling thread.
157 virtual void RemoveResourceFromDirectory(
158 const GURL& parent_content_url,
159 const GURL& resource_url,
160 const std::string& resource_id,
161 const EntryActionCallback& callback) = 0;
162
163 // Creates new collection with |directory_name| under parent directory
164 // identified with |parent_content_url|. If |parent_content_url| is empty,
165 // the new collection will be created in the root. Upon completion,
166 // invokes |callback| and passes newly created entry on the calling thread.
167 virtual void CreateDirectory(const GURL& parent_content_url,
168 const FilePath::StringType& directory_name,
169 const GetDataCallback& callback) = 0;
170
171 // Downloads a file identified by its |content_url|. The downloaded file will
172 // be stored at |local_cache_path| location. Upon completion, invokes
173 // |download_action_callback| with results on the calling thread.
174 // If |get_content_callback| is not empty,
175 // URLFetcherDelegate::OnURLFetchDownloadData will be called, which will in
176 // turn invoke |get_content_callback| on the calling thread.
177 virtual void DownloadFile(
178 const FilePath& virtual_path,
179 const FilePath& local_cache_path,
180 const GURL& content_url,
181 const DownloadActionCallback& download_action_callback,
182 const GetContentCallback& get_content_callback) = 0;
183
184 // Initiates uploading of a document/file.
185 virtual void InitiateUpload(const InitiateUploadParams& params,
186 const InitiateUploadCallback& callback) = 0;
187
188 // Resumes uploading of a document/file on the calling thread.
189 virtual void ResumeUpload(const ResumeUploadParams& params,
190 const ResumeUploadCallback& callback) = 0;
191
192 // Authorizes a Drive app with the id |app_id| to open the given document.
193 // Upon completion, invokes |callback| with results on the calling thread.
194 virtual void AuthorizeApp(const GURL& resource_url,
195 const std::string& app_id,
196 const GetDataCallback& callback) = 0;
197 };
198
199 } // namespace gdata
200
201 #endif // CHROME_BROWSER_CHROMEOS_GDATA_DOCUMENTS_SERVICE_INTERFACE_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/extensions/file_browser_private_api.cc ('k') | chrome/browser/chromeos/gdata/drive_api_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698