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

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

Powered by Google App Engine
This is Rietveld 408576698