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

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

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

Powered by Google App Engine
This is Rietveld 408576698