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

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

Issue 10829375: Cleanup: separate WAPI and Drive API code in gdata_documents_service. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix for comments 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_DRIVE_API_SERVICE_H_
6 #define CHROME_BROWSER_CHROMEOS_GDATA_DRIVE_API_SERVICE_H_
7
8 #include <string>
9
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h"
12 #include "chrome/browser/chromeos/gdata/documents_service_interface.h"
13 #include "chrome/browser/chromeos/gdata/gdata_operations.h"
14 #include "chrome/browser/chromeos/gdata/gdata_auth_service.h"
15 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h"
16
17 class FilePath;
18 class GURL;
19 class Profile;
20
21 namespace gdata {
22
23 class GDataOperationRunner;
24
25 // This class provides documents feed service calls for Drive V2 API.
26 // Details of API call are abstracted in each operation class and this class
27 // works as a thin wrapper for the API.
28 class DriveAPIService : public DocumentsServiceInterface {
29 public:
30 // Instance is usually created by GDataSystemServiceFactory and owned by
31 // GDataFileSystem.
32 DriveAPIService();
33 virtual ~DriveAPIService();
34
35 // DocumentsServiceInterface Overrides
36 virtual void Initialize(Profile* profile) OVERRIDE;
37 virtual GDataOperationRegistry* operation_registry() const OVERRIDE;
38 virtual void CancelAll() OVERRIDE;
39 virtual void Authenticate(const AuthStatusCallback& callback) OVERRIDE;
40 virtual bool HasAccessToken() const OVERRIDE;
41 virtual bool HasRefreshToken() const OVERRIDE;
42 virtual void GetDocuments(const GURL& feed_url,
43 int64 start_changestamp,
44 const std::string& search_query,
45 const std::string& directory_resource_id,
46 const GetDataCallback& callback) OVERRIDE;
47 virtual void GetDocumentEntry(const std::string& resource_id,
48 const GetDataCallback& callback) OVERRIDE;
49
50 virtual void GetAccountMetadata(const GetDataCallback& callback) OVERRIDE;
51 virtual void GetApplicationInfo(const GetDataCallback& callback) OVERRIDE;
52 virtual void DeleteDocument(const GURL& document_url,
53 const EntryActionCallback& callback) OVERRIDE;
54 virtual void DownloadDocument(
55 const FilePath& virtual_path,
56 const FilePath& local_cache_path,
57 const GURL& content_url,
58 DocumentExportFormat format,
59 const DownloadActionCallback& callback) OVERRIDE;
60 virtual void DownloadFile(
61 const FilePath& virtual_path,
62 const FilePath& local_cache_path,
63 const GURL& content_url,
64 const DownloadActionCallback& download_action_callback,
65 const GetContentCallback& get_content_callback) OVERRIDE;
66 virtual void CopyDocument(const std::string& resource_id,
67 const FilePath::StringType& new_name,
68 const GetDataCallback& callback) OVERRIDE;
69 virtual void RenameResource(const GURL& document_url,
70 const FilePath::StringType& new_name,
71 const EntryActionCallback& callback) OVERRIDE;
72 virtual void AddResourceToDirectory(
73 const GURL& parent_content_url,
74 const GURL& resource_url,
75 const EntryActionCallback& callback) OVERRIDE;
76 virtual void RemoveResourceFromDirectory(
77 const GURL& parent_content_url,
78 const GURL& resource_url,
79 const std::string& resource_id,
80 const EntryActionCallback& callback) OVERRIDE;
81 virtual void CreateDirectory(const GURL& parent_content_url,
82 const FilePath::StringType& directory_name,
83 const GetDataCallback& callback) OVERRIDE;
84 virtual void InitiateUpload(const InitiateUploadParams& params,
85 const InitiateUploadCallback& callback) OVERRIDE;
86 virtual void ResumeUpload(const ResumeUploadParams& params,
87 const ResumeUploadCallback& callback) OVERRIDE;
88 virtual void AuthorizeApp(const GURL& resource_url,
89 const std::string& app_id,
90 const GetDataCallback& callback) OVERRIDE;
91
92 private:
93 // Fetches a changelist from |url| with |start_changestamp|, using Drive V2
94 // API. If this URL is empty the call will use the default URL. Specify |url|
95 // when pagenated request should be issued.
96 // |start_changestamp| specifies the starting point of change list or 0 if
97 // all changes are necessary.
98 // Upon completion, invokes |callback| with results on calling thread.
99 virtual void GetChangelist(const GURL& url,
100 int64 start_changestamp,
101 const GetDataCallback& callback);
102
103 // Fetches a filelist from |url| with |search_query|, using Drive V2 API. If
104 // this URL is empty the call will use the default URL. Specify |url| when
105 // pagenated request should be issued.
106 // |search_query| specifies query string, whose syntax is described at
107 // https://developers.google.com/drive/search-parameters
108 virtual void GetFilelist(const GURL& url,
109 const std::string& search_query,
110 const GetDataCallback& callback);
111
112 Profile* profile_;
113 scoped_ptr<GDataOperationRunner> runner_;
114
115 DISALLOW_COPY_AND_ASSIGN(DriveAPIService);
116 };
117
118 } // namespace gdata
119
120 #endif // CHROME_BROWSER_CHROMEOS_GDATA_DRIVE_API_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/gdata/documents_service_interface.h ('k') | chrome/browser/chromeos/gdata/drive_api_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698