1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_OPERATIONS_H_
#define CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_OPERATIONS_H_
#include <string>
#include "chrome/browser/google_apis/base_operations.h"
#include "chrome/browser/google_apis/drive_api_url_generator.h"
namespace net {
class URLRequestContextGetter;
} // namespace net
namespace google_apis {
//============================== GetAboutOperation =============================
// This class performs the operation for fetching About data.
class GetAboutOperation : public GetDataOperation {
public:
GetAboutOperation(OperationRegistry* registry,
net::URLRequestContextGetter* url_request_context_getter,
const DriveApiUrlGenerator& url_generator,
const GetDataCallback& callback);
virtual ~GetAboutOperation();
protected:
// Overridden from GetDataOperation.
virtual GURL GetURL() const OVERRIDE;
private:
const DriveApiUrlGenerator url_generator_;
DISALLOW_COPY_AND_ASSIGN(GetAboutOperation);
};
//============================= GetApplistOperation ============================
// This class performs the operation for fetching Applist.
class GetApplistOperation : public GetDataOperation {
public:
GetApplistOperation(OperationRegistry* registry,
net::URLRequestContextGetter* url_request_context_getter,
const DriveApiUrlGenerator& url_generator,
const GetDataCallback& callback);
virtual ~GetApplistOperation();
protected:
// Overridden from GetDataOperation.
virtual GURL GetURL() const OVERRIDE;
private:
const DriveApiUrlGenerator url_generator_;
DISALLOW_COPY_AND_ASSIGN(GetApplistOperation);
};
//============================ GetChangelistOperation ==========================
// This class performs the operation for fetching changelist.
class GetChangelistOperation : public GetDataOperation {
public:
// |start_changestamp| specifies the starting point of change list or 0 if
// all changes are necessary.
// |url| specifies URL for document feed fetching operation. If empty URL is
// passed, the default URL is used and returns the first page of the result.
// When non-first page result is requested, |url| should be specified.
GetChangelistOperation(
OperationRegistry* registry,
net::URLRequestContextGetter* url_request_context_getter,
const DriveApiUrlGenerator& url_generator,
const GURL& url,
int64 start_changestamp,
const GetDataCallback& callback);
virtual ~GetChangelistOperation();
protected:
// Overridden from GetDataOperation.
virtual GURL GetURL() const OVERRIDE;
private:
const DriveApiUrlGenerator url_generator_;
GURL url_;
int64 start_changestamp_;
DISALLOW_COPY_AND_ASSIGN(GetChangelistOperation);
};
//============================= GetFlielistOperation ===========================
// This class performs the operation for fetching Filelist.
class GetFilelistOperation : public GetDataOperation {
public:
GetFilelistOperation(
OperationRegistry* registry,
net::URLRequestContextGetter* url_request_context_getter,
const DriveApiUrlGenerator& url_generator,
const GURL& url,
const std::string& search_string,
const GetDataCallback& callback);
virtual ~GetFilelistOperation();
protected:
// Overridden from GetDataOperation.
virtual GURL GetURL() const OVERRIDE;
private:
const DriveApiUrlGenerator url_generator_;
GURL url_;
std::string search_string_;
DISALLOW_COPY_AND_ASSIGN(GetFilelistOperation);
};
//=============================== GetFlieOperation =============================
// This class performs the operation for fetching a file.
class GetFileOperation : public GetDataOperation {
public:
GetFileOperation(OperationRegistry* registry,
net::URLRequestContextGetter* url_request_context_getter,
const DriveApiUrlGenerator& url_generator,
const std::string& file_id,
const GetDataCallback& callback);
virtual ~GetFileOperation();
protected:
// Overridden from GetDataOperation.
virtual GURL GetURL() const OVERRIDE;
private:
const DriveApiUrlGenerator url_generator_;
std::string file_id_;
DISALLOW_COPY_AND_ASSIGN(GetFileOperation);
};
// This namespace is introduced to avoid class name confliction between
// the operations for Drive API v2 and GData WAPI for transition.
// And, when the migration is done and GData WAPI's code is cleaned up,
// classes inside this namespace should be moved to the google_apis namespace.
// TODO(hidehiko): Get rid of this namespace after the migration.
namespace drive {
//========================== CreateDirectoryOperation ==========================
// This class performs the operation for creating a directory.
class CreateDirectoryOperation : public GetDataOperation {
public:
CreateDirectoryOperation(
OperationRegistry* registry,
net::URLRequestContextGetter* url_request_context_getter,
const DriveApiUrlGenerator& url_generator,
const std::string& parent_resource_id,
const std::string& directory_name,
const GetDataCallback& callback);
virtual ~CreateDirectoryOperation();
protected:
// Overridden from GetDataOperation.
virtual GURL GetURL() const OVERRIDE;
virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE;
virtual bool GetContentData(std::string* upload_content_type,
std::string* upload_content) OVERRIDE;
private:
const DriveApiUrlGenerator url_generator_;
const std::string parent_resource_id_;
const std::string directory_name_;
DISALLOW_COPY_AND_ASSIGN(CreateDirectoryOperation);
};
} // namespace drive
} // namespace google_apis
#endif // CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_OPERATIONS_H_
|