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

Side by Side Diff: google_apis/drive/drive_api_requests.h

Issue 625293003: replace OVERRIDE and FINAL with override and final in google_apis/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another rebase on master Created 6 years, 2 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef GOOGLE_APIS_DRIVE_DRIVE_API_REQUESTS_H_ 5 #ifndef GOOGLE_APIS_DRIVE_DRIVE_API_REQUESTS_H_
6 #define GOOGLE_APIS_DRIVE_DRIVE_API_REQUESTS_H_ 6 #define GOOGLE_APIS_DRIVE_DRIVE_API_REQUESTS_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 public: 48 public:
49 explicit DriveApiPartialFieldRequest(RequestSender* sender); 49 explicit DriveApiPartialFieldRequest(RequestSender* sender);
50 virtual ~DriveApiPartialFieldRequest(); 50 virtual ~DriveApiPartialFieldRequest();
51 51
52 // Optional parameter. 52 // Optional parameter.
53 const std::string& fields() const { return fields_; } 53 const std::string& fields() const { return fields_; }
54 void set_fields(const std::string& fields) { fields_ = fields; } 54 void set_fields(const std::string& fields) { fields_ = fields; }
55 55
56 protected: 56 protected:
57 // UrlFetchRequestBase overrides. 57 // UrlFetchRequestBase overrides.
58 virtual GURL GetURL() const OVERRIDE; 58 virtual GURL GetURL() const override;
59 59
60 // Derived classes should override GetURLInternal instead of GetURL() 60 // Derived classes should override GetURLInternal instead of GetURL()
61 // directly. 61 // directly.
62 virtual GURL GetURLInternal() const = 0; 62 virtual GURL GetURLInternal() const = 0;
63 63
64 private: 64 private:
65 std::string fields_; 65 std::string fields_;
66 66
67 DISALLOW_COPY_AND_ASSIGN(DriveApiPartialFieldRequest); 67 DISALLOW_COPY_AND_ASSIGN(DriveApiPartialFieldRequest);
68 }; 68 };
(...skipping 13 matching lines...) Expand all
82 DriveApiDataRequest(RequestSender* sender, const Callback& callback) 82 DriveApiDataRequest(RequestSender* sender, const Callback& callback)
83 : DriveApiPartialFieldRequest(sender), 83 : DriveApiPartialFieldRequest(sender),
84 callback_(callback), 84 callback_(callback),
85 weak_ptr_factory_(this) { 85 weak_ptr_factory_(this) {
86 DCHECK(!callback_.is_null()); 86 DCHECK(!callback_.is_null());
87 } 87 }
88 virtual ~DriveApiDataRequest() {} 88 virtual ~DriveApiDataRequest() {}
89 89
90 protected: 90 protected:
91 // UrlFetchRequestBase overrides. 91 // UrlFetchRequestBase overrides.
92 virtual void ProcessURLFetchResults(const net::URLFetcher* source) OVERRIDE { 92 virtual void ProcessURLFetchResults(const net::URLFetcher* source) override {
93 GDataErrorCode error = GetErrorCode(); 93 GDataErrorCode error = GetErrorCode();
94 switch (error) { 94 switch (error) {
95 case HTTP_SUCCESS: 95 case HTTP_SUCCESS:
96 case HTTP_CREATED: 96 case HTTP_CREATED:
97 base::PostTaskAndReplyWithResult( 97 base::PostTaskAndReplyWithResult(
98 blocking_task_runner(), 98 blocking_task_runner(),
99 FROM_HERE, 99 FROM_HERE,
100 base::Bind(&DriveApiDataRequest::Parse, response_writer()->data()), 100 base::Bind(&DriveApiDataRequest::Parse, response_writer()->data()),
101 base::Bind(&DriveApiDataRequest::OnDataParsed, 101 base::Bind(&DriveApiDataRequest::OnDataParsed,
102 weak_ptr_factory_.GetWeakPtr(), error)); 102 weak_ptr_factory_.GetWeakPtr(), error));
103 break; 103 break;
104 default: 104 default:
105 RunCallbackOnPrematureFailure(error); 105 RunCallbackOnPrematureFailure(error);
106 OnProcessURLFetchResultsComplete(); 106 OnProcessURLFetchResultsComplete();
107 break; 107 break;
108 } 108 }
109 } 109 }
110 110
111 virtual void RunCallbackOnPrematureFailure(GDataErrorCode error) OVERRIDE { 111 virtual void RunCallbackOnPrematureFailure(GDataErrorCode error) override {
112 callback_.Run(error, scoped_ptr<DataType>()); 112 callback_.Run(error, scoped_ptr<DataType>());
113 } 113 }
114 114
115 private: 115 private:
116 // Parses the |json| string by using DataType::CreateFrom. 116 // Parses the |json| string by using DataType::CreateFrom.
117 static scoped_ptr<DataType> Parse(const std::string& json) { 117 static scoped_ptr<DataType> Parse(const std::string& json) {
118 scoped_ptr<base::Value> value = ParseJson(json); 118 scoped_ptr<base::Value> value = ParseJson(json);
119 return value ? DataType::CreateFrom(*value) : scoped_ptr<DataType>(); 119 return value ? DataType::CreateFrom(*value) : scoped_ptr<DataType>();
120 } 120 }
121 121
(...skipping 25 matching lines...) Expand all
147 const DriveApiUrlGenerator& url_generator, 147 const DriveApiUrlGenerator& url_generator,
148 const FileResourceCallback& callback); 148 const FileResourceCallback& callback);
149 virtual ~FilesGetRequest(); 149 virtual ~FilesGetRequest();
150 150
151 // Required parameter. 151 // Required parameter.
152 const std::string& file_id() const { return file_id_; } 152 const std::string& file_id() const { return file_id_; }
153 void set_file_id(const std::string& file_id) { file_id_ = file_id; } 153 void set_file_id(const std::string& file_id) { file_id_ = file_id; }
154 154
155 protected: 155 protected:
156 // Overridden from DriveApiDataRequest. 156 // Overridden from DriveApiDataRequest.
157 virtual GURL GetURLInternal() const OVERRIDE; 157 virtual GURL GetURLInternal() const override;
158 158
159 private: 159 private:
160 const DriveApiUrlGenerator url_generator_; 160 const DriveApiUrlGenerator url_generator_;
161 std::string file_id_; 161 std::string file_id_;
162 162
163 DISALLOW_COPY_AND_ASSIGN(FilesGetRequest); 163 DISALLOW_COPY_AND_ASSIGN(FilesGetRequest);
164 }; 164 };
165 165
166 //============================ FilesAuthorizeRequest =========================== 166 //============================ FilesAuthorizeRequest ===========================
167 167
168 // This class performs request for authorizing an app to access a file. 168 // This class performs request for authorizing an app to access a file.
169 // This request is mapped to /drive/v2internal/file/authorize internal endpoint. 169 // This request is mapped to /drive/v2internal/file/authorize internal endpoint.
170 class FilesAuthorizeRequest : public DriveApiDataRequest<FileResource> { 170 class FilesAuthorizeRequest : public DriveApiDataRequest<FileResource> {
171 public: 171 public:
172 FilesAuthorizeRequest(RequestSender* sender, 172 FilesAuthorizeRequest(RequestSender* sender,
173 const DriveApiUrlGenerator& url_generator, 173 const DriveApiUrlGenerator& url_generator,
174 const FileResourceCallback& callback); 174 const FileResourceCallback& callback);
175 virtual ~FilesAuthorizeRequest(); 175 virtual ~FilesAuthorizeRequest();
176 176
177 // Required parameter. 177 // Required parameter.
178 const std::string& file_id() const { return file_id_; } 178 const std::string& file_id() const { return file_id_; }
179 void set_file_id(const std::string& file_id) { file_id_ = file_id; } 179 void set_file_id(const std::string& file_id) { file_id_ = file_id; }
180 const std::string& app_id() const { return app_id_; } 180 const std::string& app_id() const { return app_id_; }
181 void set_app_id(const std::string& app_id) { app_id_ = app_id; } 181 void set_app_id(const std::string& app_id) { app_id_ = app_id; }
182 182
183 protected: 183 protected:
184 // Overridden from GetDataRequest. 184 // Overridden from GetDataRequest.
185 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; 185 virtual net::URLFetcher::RequestType GetRequestType() const override;
186 186
187 // Overridden from DriveApiDataRequest. 187 // Overridden from DriveApiDataRequest.
188 virtual GURL GetURLInternal() const OVERRIDE; 188 virtual GURL GetURLInternal() const override;
189 189
190 private: 190 private:
191 const DriveApiUrlGenerator url_generator_; 191 const DriveApiUrlGenerator url_generator_;
192 std::string file_id_; 192 std::string file_id_;
193 std::string app_id_; 193 std::string app_id_;
194 194
195 DISALLOW_COPY_AND_ASSIGN(FilesAuthorizeRequest); 195 DISALLOW_COPY_AND_ASSIGN(FilesAuthorizeRequest);
196 }; 196 };
197 197
198 //============================ FilesInsertRequest ============================= 198 //============================ FilesInsertRequest =============================
(...skipping 29 matching lines...) Expand all
228 } 228 }
229 229
230 const std::vector<std::string>& parents() const { return parents_; } 230 const std::vector<std::string>& parents() const { return parents_; }
231 void add_parent(const std::string& parent) { parents_.push_back(parent); } 231 void add_parent(const std::string& parent) { parents_.push_back(parent); }
232 232
233 const std::string& title() const { return title_; } 233 const std::string& title() const { return title_; }
234 void set_title(const std::string& title) { title_ = title; } 234 void set_title(const std::string& title) { title_ = title; }
235 235
236 protected: 236 protected:
237 // Overridden from GetDataRequest. 237 // Overridden from GetDataRequest.
238 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; 238 virtual net::URLFetcher::RequestType GetRequestType() const override;
239 virtual bool GetContentData(std::string* upload_content_type, 239 virtual bool GetContentData(std::string* upload_content_type,
240 std::string* upload_content) OVERRIDE; 240 std::string* upload_content) override;
241 241
242 // Overridden from DriveApiDataRequest. 242 // Overridden from DriveApiDataRequest.
243 virtual GURL GetURLInternal() const OVERRIDE; 243 virtual GURL GetURLInternal() const override;
244 244
245 private: 245 private:
246 const DriveApiUrlGenerator url_generator_; 246 const DriveApiUrlGenerator url_generator_;
247 247
248 base::Time last_viewed_by_me_date_; 248 base::Time last_viewed_by_me_date_;
249 std::string mime_type_; 249 std::string mime_type_;
250 base::Time modified_date_; 250 base::Time modified_date_;
251 std::vector<std::string> parents_; 251 std::vector<std::string> parents_;
252 std::string title_; 252 std::string title_;
253 253
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 } 298 }
299 void set_last_viewed_by_me_date(const base::Time& last_viewed_by_me_date) { 299 void set_last_viewed_by_me_date(const base::Time& last_viewed_by_me_date) {
300 last_viewed_by_me_date_ = last_viewed_by_me_date; 300 last_viewed_by_me_date_ = last_viewed_by_me_date;
301 } 301 }
302 302
303 const std::vector<std::string>& parents() const { return parents_; } 303 const std::vector<std::string>& parents() const { return parents_; }
304 void add_parent(const std::string& parent) { parents_.push_back(parent); } 304 void add_parent(const std::string& parent) { parents_.push_back(parent); }
305 305
306 protected: 306 protected:
307 // Overridden from URLFetchRequestBase. 307 // Overridden from URLFetchRequestBase.
308 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; 308 virtual net::URLFetcher::RequestType GetRequestType() const override;
309 virtual std::vector<std::string> GetExtraRequestHeaders() const OVERRIDE; 309 virtual std::vector<std::string> GetExtraRequestHeaders() const override;
310 virtual bool GetContentData(std::string* upload_content_type, 310 virtual bool GetContentData(std::string* upload_content_type,
311 std::string* upload_content) OVERRIDE; 311 std::string* upload_content) override;
312 312
313 // Overridden from DriveApiDataRequest. 313 // Overridden from DriveApiDataRequest.
314 virtual GURL GetURLInternal() const OVERRIDE; 314 virtual GURL GetURLInternal() const override;
315 315
316 private: 316 private:
317 const DriveApiUrlGenerator url_generator_; 317 const DriveApiUrlGenerator url_generator_;
318 318
319 std::string file_id_; 319 std::string file_id_;
320 bool set_modified_date_; 320 bool set_modified_date_;
321 bool update_viewed_date_; 321 bool update_viewed_date_;
322 322
323 std::string title_; 323 std::string title_;
324 base::Time modified_date_; 324 base::Time modified_date_;
(...skipping 27 matching lines...) Expand all
352 const base::Time& modified_date() const { return modified_date_; } 352 const base::Time& modified_date() const { return modified_date_; }
353 void set_modified_date(const base::Time& modified_date) { 353 void set_modified_date(const base::Time& modified_date) {
354 modified_date_ = modified_date; 354 modified_date_ = modified_date;
355 } 355 }
356 356
357 const std::string& title() const { return title_; } 357 const std::string& title() const { return title_; }
358 void set_title(const std::string& title) { title_ = title; } 358 void set_title(const std::string& title) { title_ = title; }
359 359
360 protected: 360 protected:
361 // Overridden from URLFetchRequestBase. 361 // Overridden from URLFetchRequestBase.
362 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; 362 virtual net::URLFetcher::RequestType GetRequestType() const override;
363 virtual bool GetContentData(std::string* upload_content_type, 363 virtual bool GetContentData(std::string* upload_content_type,
364 std::string* upload_content) OVERRIDE; 364 std::string* upload_content) override;
365 365
366 // Overridden from DriveApiDataRequest. 366 // Overridden from DriveApiDataRequest.
367 virtual GURL GetURLInternal() const OVERRIDE; 367 virtual GURL GetURLInternal() const override;
368 368
369 private: 369 private:
370 const DriveApiUrlGenerator url_generator_; 370 const DriveApiUrlGenerator url_generator_;
371 371
372 std::string file_id_; 372 std::string file_id_;
373 base::Time modified_date_; 373 base::Time modified_date_;
374 std::vector<std::string> parents_; 374 std::vector<std::string> parents_;
375 std::string title_; 375 std::string title_;
376 376
377 DISALLOW_COPY_AND_ASSIGN(FilesCopyRequest); 377 DISALLOW_COPY_AND_ASSIGN(FilesCopyRequest);
(...skipping 21 matching lines...) Expand all
399 const std::string& page_token() const { return page_token_; } 399 const std::string& page_token() const { return page_token_; }
400 void set_page_token(const std::string& page_token) { 400 void set_page_token(const std::string& page_token) {
401 page_token_ = page_token; 401 page_token_ = page_token;
402 } 402 }
403 403
404 const std::string& q() const { return q_; } 404 const std::string& q() const { return q_; }
405 void set_q(const std::string& q) { q_ = q; } 405 void set_q(const std::string& q) { q_ = q; }
406 406
407 protected: 407 protected:
408 // Overridden from DriveApiDataRequest. 408 // Overridden from DriveApiDataRequest.
409 virtual GURL GetURLInternal() const OVERRIDE; 409 virtual GURL GetURLInternal() const override;
410 410
411 private: 411 private:
412 const DriveApiUrlGenerator url_generator_; 412 const DriveApiUrlGenerator url_generator_;
413 int max_results_; 413 int max_results_;
414 std::string page_token_; 414 std::string page_token_;
415 std::string q_; 415 std::string q_;
416 416
417 DISALLOW_COPY_AND_ASSIGN(FilesListRequest); 417 DISALLOW_COPY_AND_ASSIGN(FilesListRequest);
418 }; 418 };
419 419
420 //========================= FilesListNextPageRequest ========================== 420 //========================= FilesListNextPageRequest ==========================
421 421
422 // There are two ways to obtain next pages of "Files: list" result (if paged). 422 // There are two ways to obtain next pages of "Files: list" result (if paged).
423 // 1) Set pageToken and all params used for the initial request. 423 // 1) Set pageToken and all params used for the initial request.
424 // 2) Use URL in the nextLink field in the previous response. 424 // 2) Use URL in the nextLink field in the previous response.
425 // This class implements 2)'s request. 425 // This class implements 2)'s request.
426 class FilesListNextPageRequest : public DriveApiDataRequest<FileList> { 426 class FilesListNextPageRequest : public DriveApiDataRequest<FileList> {
427 public: 427 public:
428 FilesListNextPageRequest(RequestSender* sender, 428 FilesListNextPageRequest(RequestSender* sender,
429 const FileListCallback& callback); 429 const FileListCallback& callback);
430 virtual ~FilesListNextPageRequest(); 430 virtual ~FilesListNextPageRequest();
431 431
432 const GURL& next_link() const { return next_link_; } 432 const GURL& next_link() const { return next_link_; }
433 void set_next_link(const GURL& next_link) { next_link_ = next_link; } 433 void set_next_link(const GURL& next_link) { next_link_ = next_link; }
434 434
435 protected: 435 protected:
436 // Overridden from DriveApiDataRequest. 436 // Overridden from DriveApiDataRequest.
437 virtual GURL GetURLInternal() const OVERRIDE; 437 virtual GURL GetURLInternal() const override;
438 438
439 private: 439 private:
440 GURL next_link_; 440 GURL next_link_;
441 441
442 DISALLOW_COPY_AND_ASSIGN(FilesListNextPageRequest); 442 DISALLOW_COPY_AND_ASSIGN(FilesListNextPageRequest);
443 }; 443 };
444 444
445 //============================= FilesDeleteRequest ============================= 445 //============================= FilesDeleteRequest =============================
446 446
447 // This class performs the request for deleting a resource. 447 // This class performs the request for deleting a resource.
448 // This request is mapped to 448 // This request is mapped to
449 // https://developers.google.com/drive/v2/reference/files/delete 449 // https://developers.google.com/drive/v2/reference/files/delete
450 class FilesDeleteRequest : public EntryActionRequest { 450 class FilesDeleteRequest : public EntryActionRequest {
451 public: 451 public:
452 FilesDeleteRequest(RequestSender* sender, 452 FilesDeleteRequest(RequestSender* sender,
453 const DriveApiUrlGenerator& url_generator, 453 const DriveApiUrlGenerator& url_generator,
454 const EntryActionCallback& callback); 454 const EntryActionCallback& callback);
455 virtual ~FilesDeleteRequest(); 455 virtual ~FilesDeleteRequest();
456 456
457 // Required parameter. 457 // Required parameter.
458 const std::string& file_id() const { return file_id_; } 458 const std::string& file_id() const { return file_id_; }
459 void set_file_id(const std::string& file_id) { file_id_ = file_id; } 459 void set_file_id(const std::string& file_id) { file_id_ = file_id; }
460 void set_etag(const std::string& etag) { etag_ = etag; } 460 void set_etag(const std::string& etag) { etag_ = etag; }
461 461
462 protected: 462 protected:
463 // Overridden from UrlFetchRequestBase. 463 // Overridden from UrlFetchRequestBase.
464 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; 464 virtual net::URLFetcher::RequestType GetRequestType() const override;
465 virtual GURL GetURL() const OVERRIDE; 465 virtual GURL GetURL() const override;
466 virtual std::vector<std::string> GetExtraRequestHeaders() const OVERRIDE; 466 virtual std::vector<std::string> GetExtraRequestHeaders() const override;
467 467
468 private: 468 private:
469 const DriveApiUrlGenerator url_generator_; 469 const DriveApiUrlGenerator url_generator_;
470 std::string file_id_; 470 std::string file_id_;
471 std::string etag_; 471 std::string etag_;
472 472
473 DISALLOW_COPY_AND_ASSIGN(FilesDeleteRequest); 473 DISALLOW_COPY_AND_ASSIGN(FilesDeleteRequest);
474 }; 474 };
475 475
476 //============================= FilesTrashRequest ============================== 476 //============================= FilesTrashRequest ==============================
477 477
478 // This class performs the request for trashing a resource. 478 // This class performs the request for trashing a resource.
479 // This request is mapped to 479 // This request is mapped to
480 // https://developers.google.com/drive/v2/reference/files/trash 480 // https://developers.google.com/drive/v2/reference/files/trash
481 class FilesTrashRequest : public DriveApiDataRequest<FileResource> { 481 class FilesTrashRequest : public DriveApiDataRequest<FileResource> {
482 public: 482 public:
483 FilesTrashRequest(RequestSender* sender, 483 FilesTrashRequest(RequestSender* sender,
484 const DriveApiUrlGenerator& url_generator, 484 const DriveApiUrlGenerator& url_generator,
485 const FileResourceCallback& callback); 485 const FileResourceCallback& callback);
486 virtual ~FilesTrashRequest(); 486 virtual ~FilesTrashRequest();
487 487
488 // Required parameter. 488 // Required parameter.
489 const std::string& file_id() const { return file_id_; } 489 const std::string& file_id() const { return file_id_; }
490 void set_file_id(const std::string& file_id) { file_id_ = file_id; } 490 void set_file_id(const std::string& file_id) { file_id_ = file_id; }
491 491
492 protected: 492 protected:
493 // Overridden from UrlFetchRequestBase. 493 // Overridden from UrlFetchRequestBase.
494 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; 494 virtual net::URLFetcher::RequestType GetRequestType() const override;
495 495
496 // Overridden from DriveApiDataRequest. 496 // Overridden from DriveApiDataRequest.
497 virtual GURL GetURLInternal() const OVERRIDE; 497 virtual GURL GetURLInternal() const override;
498 498
499 private: 499 private:
500 const DriveApiUrlGenerator url_generator_; 500 const DriveApiUrlGenerator url_generator_;
501 std::string file_id_; 501 std::string file_id_;
502 502
503 DISALLOW_COPY_AND_ASSIGN(FilesTrashRequest); 503 DISALLOW_COPY_AND_ASSIGN(FilesTrashRequest);
504 }; 504 };
505 505
506 //============================== AboutGetRequest ============================= 506 //============================== AboutGetRequest =============================
507 507
508 // This class performs the request for fetching About data. 508 // This class performs the request for fetching About data.
509 // This request is mapped to 509 // This request is mapped to
510 // https://developers.google.com/drive/v2/reference/about/get 510 // https://developers.google.com/drive/v2/reference/about/get
511 class AboutGetRequest : public DriveApiDataRequest<AboutResource> { 511 class AboutGetRequest : public DriveApiDataRequest<AboutResource> {
512 public: 512 public:
513 AboutGetRequest(RequestSender* sender, 513 AboutGetRequest(RequestSender* sender,
514 const DriveApiUrlGenerator& url_generator, 514 const DriveApiUrlGenerator& url_generator,
515 const AboutResourceCallback& callback); 515 const AboutResourceCallback& callback);
516 virtual ~AboutGetRequest(); 516 virtual ~AboutGetRequest();
517 517
518 protected: 518 protected:
519 // Overridden from DriveApiDataRequest. 519 // Overridden from DriveApiDataRequest.
520 virtual GURL GetURLInternal() const OVERRIDE; 520 virtual GURL GetURLInternal() const override;
521 521
522 private: 522 private:
523 const DriveApiUrlGenerator url_generator_; 523 const DriveApiUrlGenerator url_generator_;
524 524
525 DISALLOW_COPY_AND_ASSIGN(AboutGetRequest); 525 DISALLOW_COPY_AND_ASSIGN(AboutGetRequest);
526 }; 526 };
527 527
528 //============================ ChangesListRequest ============================ 528 //============================ ChangesListRequest ============================
529 529
530 // This class performs the request for fetching ChangeList. 530 // This class performs the request for fetching ChangeList.
(...skipping 23 matching lines...) Expand all
554 page_token_ = page_token; 554 page_token_ = page_token;
555 } 555 }
556 556
557 int64 start_change_id() const { return start_change_id_; } 557 int64 start_change_id() const { return start_change_id_; }
558 void set_start_change_id(int64 start_change_id) { 558 void set_start_change_id(int64 start_change_id) {
559 start_change_id_ = start_change_id; 559 start_change_id_ = start_change_id;
560 } 560 }
561 561
562 protected: 562 protected:
563 // Overridden from DriveApiDataRequest. 563 // Overridden from DriveApiDataRequest.
564 virtual GURL GetURLInternal() const OVERRIDE; 564 virtual GURL GetURLInternal() const override;
565 565
566 private: 566 private:
567 const DriveApiUrlGenerator url_generator_; 567 const DriveApiUrlGenerator url_generator_;
568 bool include_deleted_; 568 bool include_deleted_;
569 int max_results_; 569 int max_results_;
570 std::string page_token_; 570 std::string page_token_;
571 int64 start_change_id_; 571 int64 start_change_id_;
572 572
573 DISALLOW_COPY_AND_ASSIGN(ChangesListRequest); 573 DISALLOW_COPY_AND_ASSIGN(ChangesListRequest);
574 }; 574 };
575 575
576 //======================== ChangesListNextPageRequest ========================= 576 //======================== ChangesListNextPageRequest =========================
577 577
578 // There are two ways to obtain next pages of "Changes: list" result (if paged). 578 // There are two ways to obtain next pages of "Changes: list" result (if paged).
579 // 1) Set pageToken and all params used for the initial request. 579 // 1) Set pageToken and all params used for the initial request.
580 // 2) Use URL in the nextLink field in the previous response. 580 // 2) Use URL in the nextLink field in the previous response.
581 // This class implements 2)'s request. 581 // This class implements 2)'s request.
582 class ChangesListNextPageRequest : public DriveApiDataRequest<ChangeList> { 582 class ChangesListNextPageRequest : public DriveApiDataRequest<ChangeList> {
583 public: 583 public:
584 ChangesListNextPageRequest(RequestSender* sender, 584 ChangesListNextPageRequest(RequestSender* sender,
585 const ChangeListCallback& callback); 585 const ChangeListCallback& callback);
586 virtual ~ChangesListNextPageRequest(); 586 virtual ~ChangesListNextPageRequest();
587 587
588 const GURL& next_link() const { return next_link_; } 588 const GURL& next_link() const { return next_link_; }
589 void set_next_link(const GURL& next_link) { next_link_ = next_link; } 589 void set_next_link(const GURL& next_link) { next_link_ = next_link; }
590 590
591 protected: 591 protected:
592 // Overridden from DriveApiDataRequest. 592 // Overridden from DriveApiDataRequest.
593 virtual GURL GetURLInternal() const OVERRIDE; 593 virtual GURL GetURLInternal() const override;
594 594
595 private: 595 private:
596 GURL next_link_; 596 GURL next_link_;
597 597
598 DISALLOW_COPY_AND_ASSIGN(ChangesListNextPageRequest); 598 DISALLOW_COPY_AND_ASSIGN(ChangesListNextPageRequest);
599 }; 599 };
600 600
601 //============================= AppsListRequest ============================ 601 //============================= AppsListRequest ============================
602 602
603 // This class performs the request for fetching AppList. 603 // This class performs the request for fetching AppList.
604 // This request is mapped to 604 // This request is mapped to
605 // https://developers.google.com/drive/v2/reference/apps/list 605 // https://developers.google.com/drive/v2/reference/apps/list
606 class AppsListRequest : public DriveApiDataRequest<AppList> { 606 class AppsListRequest : public DriveApiDataRequest<AppList> {
607 public: 607 public:
608 AppsListRequest(RequestSender* sender, 608 AppsListRequest(RequestSender* sender,
609 const DriveApiUrlGenerator& url_generator, 609 const DriveApiUrlGenerator& url_generator,
610 bool use_internal_endpoint, 610 bool use_internal_endpoint,
611 const AppListCallback& callback); 611 const AppListCallback& callback);
612 virtual ~AppsListRequest(); 612 virtual ~AppsListRequest();
613 613
614 protected: 614 protected:
615 // Overridden from DriveApiDataRequest. 615 // Overridden from DriveApiDataRequest.
616 virtual GURL GetURLInternal() const OVERRIDE; 616 virtual GURL GetURLInternal() const override;
617 617
618 private: 618 private:
619 const DriveApiUrlGenerator url_generator_; 619 const DriveApiUrlGenerator url_generator_;
620 bool use_internal_endpoint_; 620 bool use_internal_endpoint_;
621 621
622 DISALLOW_COPY_AND_ASSIGN(AppsListRequest); 622 DISALLOW_COPY_AND_ASSIGN(AppsListRequest);
623 }; 623 };
624 624
625 //============================= AppsDeleteRequest ============================== 625 //============================= AppsDeleteRequest ==============================
626 626
627 // This class performs the request for deleting a Drive app. 627 // This class performs the request for deleting a Drive app.
628 // This request is mapped to 628 // This request is mapped to
629 // https://developers.google.com/drive/v2/reference/files/trash 629 // https://developers.google.com/drive/v2/reference/files/trash
630 class AppsDeleteRequest : public EntryActionRequest { 630 class AppsDeleteRequest : public EntryActionRequest {
631 public: 631 public:
632 AppsDeleteRequest(RequestSender* sender, 632 AppsDeleteRequest(RequestSender* sender,
633 const DriveApiUrlGenerator& url_generator, 633 const DriveApiUrlGenerator& url_generator,
634 const EntryActionCallback& callback); 634 const EntryActionCallback& callback);
635 virtual ~AppsDeleteRequest(); 635 virtual ~AppsDeleteRequest();
636 636
637 // Required parameter. 637 // Required parameter.
638 const std::string& app_id() const { return app_id_; } 638 const std::string& app_id() const { return app_id_; }
639 void set_app_id(const std::string& app_id) { app_id_ = app_id; } 639 void set_app_id(const std::string& app_id) { app_id_ = app_id; }
640 640
641 protected: 641 protected:
642 // Overridden from UrlFetchRequestBase. 642 // Overridden from UrlFetchRequestBase.
643 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; 643 virtual net::URLFetcher::RequestType GetRequestType() const override;
644 virtual GURL GetURL() const OVERRIDE; 644 virtual GURL GetURL() const override;
645 645
646 private: 646 private:
647 const DriveApiUrlGenerator url_generator_; 647 const DriveApiUrlGenerator url_generator_;
648 std::string app_id_; 648 std::string app_id_;
649 649
650 DISALLOW_COPY_AND_ASSIGN(AppsDeleteRequest); 650 DISALLOW_COPY_AND_ASSIGN(AppsDeleteRequest);
651 }; 651 };
652 652
653 //========================== ChildrenInsertRequest ============================ 653 //========================== ChildrenInsertRequest ============================
654 654
(...skipping 12 matching lines...) Expand all
667 void set_folder_id(const std::string& folder_id) { 667 void set_folder_id(const std::string& folder_id) {
668 folder_id_ = folder_id; 668 folder_id_ = folder_id;
669 } 669 }
670 670
671 // Required body. 671 // Required body.
672 const std::string& id() const { return id_; } 672 const std::string& id() const { return id_; }
673 void set_id(const std::string& id) { id_ = id; } 673 void set_id(const std::string& id) { id_ = id; }
674 674
675 protected: 675 protected:
676 // UrlFetchRequestBase overrides. 676 // UrlFetchRequestBase overrides.
677 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; 677 virtual net::URLFetcher::RequestType GetRequestType() const override;
678 virtual GURL GetURL() const OVERRIDE; 678 virtual GURL GetURL() const override;
679 virtual bool GetContentData(std::string* upload_content_type, 679 virtual bool GetContentData(std::string* upload_content_type,
680 std::string* upload_content) OVERRIDE; 680 std::string* upload_content) override;
681 681
682 private: 682 private:
683 const DriveApiUrlGenerator url_generator_; 683 const DriveApiUrlGenerator url_generator_;
684 std::string folder_id_; 684 std::string folder_id_;
685 std::string id_; 685 std::string id_;
686 686
687 DISALLOW_COPY_AND_ASSIGN(ChildrenInsertRequest); 687 DISALLOW_COPY_AND_ASSIGN(ChildrenInsertRequest);
688 }; 688 };
689 689
690 //========================== ChildrenDeleteRequest ============================ 690 //========================== ChildrenDeleteRequest ============================
(...skipping 15 matching lines...) Expand all
706 child_id_ = child_id; 706 child_id_ = child_id;
707 } 707 }
708 708
709 const std::string& folder_id() const { return folder_id_; } 709 const std::string& folder_id() const { return folder_id_; }
710 void set_folder_id(const std::string& folder_id) { 710 void set_folder_id(const std::string& folder_id) {
711 folder_id_ = folder_id; 711 folder_id_ = folder_id;
712 } 712 }
713 713
714 protected: 714 protected:
715 // UrlFetchRequestBase overrides. 715 // UrlFetchRequestBase overrides.
716 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; 716 virtual net::URLFetcher::RequestType GetRequestType() const override;
717 virtual GURL GetURL() const OVERRIDE; 717 virtual GURL GetURL() const override;
718 718
719 private: 719 private:
720 const DriveApiUrlGenerator url_generator_; 720 const DriveApiUrlGenerator url_generator_;
721 std::string child_id_; 721 std::string child_id_;
722 std::string folder_id_; 722 std::string folder_id_;
723 723
724 DISALLOW_COPY_AND_ASSIGN(ChildrenDeleteRequest); 724 DISALLOW_COPY_AND_ASSIGN(ChildrenDeleteRequest);
725 }; 725 };
726 726
727 //======================= InitiateUploadNewFileRequest ======================= 727 //======================= InitiateUploadNewFileRequest =======================
(...skipping 21 matching lines...) Expand all
749 } 749 }
750 const base::Time& last_viewed_by_me_date() const { 750 const base::Time& last_viewed_by_me_date() const {
751 return last_viewed_by_me_date_; 751 return last_viewed_by_me_date_;
752 } 752 }
753 void set_last_viewed_by_me_date(const base::Time& last_viewed_by_me_date) { 753 void set_last_viewed_by_me_date(const base::Time& last_viewed_by_me_date) {
754 last_viewed_by_me_date_ = last_viewed_by_me_date; 754 last_viewed_by_me_date_ = last_viewed_by_me_date;
755 } 755 }
756 756
757 protected: 757 protected:
758 // UrlFetchRequestBase overrides. 758 // UrlFetchRequestBase overrides.
759 virtual GURL GetURL() const OVERRIDE; 759 virtual GURL GetURL() const override;
760 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; 760 virtual net::URLFetcher::RequestType GetRequestType() const override;
761 virtual bool GetContentData(std::string* upload_content_type, 761 virtual bool GetContentData(std::string* upload_content_type,
762 std::string* upload_content) OVERRIDE; 762 std::string* upload_content) override;
763 763
764 private: 764 private:
765 const DriveApiUrlGenerator url_generator_; 765 const DriveApiUrlGenerator url_generator_;
766 const std::string parent_resource_id_; 766 const std::string parent_resource_id_;
767 const std::string title_; 767 const std::string title_;
768 768
769 base::Time modified_date_; 769 base::Time modified_date_;
770 base::Time last_viewed_by_me_date_; 770 base::Time last_viewed_by_me_date_;
771 771
772 DISALLOW_COPY_AND_ASSIGN(InitiateUploadNewFileRequest); 772 DISALLOW_COPY_AND_ASSIGN(InitiateUploadNewFileRequest);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 } 806 }
807 const base::Time& last_viewed_by_me_date() const { 807 const base::Time& last_viewed_by_me_date() const {
808 return last_viewed_by_me_date_; 808 return last_viewed_by_me_date_;
809 } 809 }
810 void set_last_viewed_by_me_date(const base::Time& last_viewed_by_me_date) { 810 void set_last_viewed_by_me_date(const base::Time& last_viewed_by_me_date) {
811 last_viewed_by_me_date_ = last_viewed_by_me_date; 811 last_viewed_by_me_date_ = last_viewed_by_me_date;
812 } 812 }
813 813
814 protected: 814 protected:
815 // UrlFetchRequestBase overrides. 815 // UrlFetchRequestBase overrides.
816 virtual GURL GetURL() const OVERRIDE; 816 virtual GURL GetURL() const override;
817 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; 817 virtual net::URLFetcher::RequestType GetRequestType() const override;
818 virtual std::vector<std::string> GetExtraRequestHeaders() const OVERRIDE; 818 virtual std::vector<std::string> GetExtraRequestHeaders() const override;
819 virtual bool GetContentData(std::string* upload_content_type, 819 virtual bool GetContentData(std::string* upload_content_type,
820 std::string* upload_content) OVERRIDE; 820 std::string* upload_content) override;
821 821
822 private: 822 private:
823 const DriveApiUrlGenerator url_generator_; 823 const DriveApiUrlGenerator url_generator_;
824 const std::string resource_id_; 824 const std::string resource_id_;
825 const std::string etag_; 825 const std::string etag_;
826 826
827 std::string parent_resource_id_; 827 std::string parent_resource_id_;
828 std::string title_; 828 std::string title_;
829 base::Time modified_date_; 829 base::Time modified_date_;
830 base::Time last_viewed_by_me_date_; 830 base::Time last_viewed_by_me_date_;
(...skipping 21 matching lines...) Expand all
852 const std::string& content_type, 852 const std::string& content_type,
853 const base::FilePath& local_file_path, 853 const base::FilePath& local_file_path,
854 const UploadRangeCallback& callback, 854 const UploadRangeCallback& callback,
855 const ProgressCallback& progress_callback); 855 const ProgressCallback& progress_callback);
856 virtual ~ResumeUploadRequest(); 856 virtual ~ResumeUploadRequest();
857 857
858 protected: 858 protected:
859 // UploadRangeRequestBase overrides. 859 // UploadRangeRequestBase overrides.
860 virtual void OnRangeRequestComplete( 860 virtual void OnRangeRequestComplete(
861 const UploadRangeResponse& response, 861 const UploadRangeResponse& response,
862 scoped_ptr<base::Value> value) OVERRIDE; 862 scoped_ptr<base::Value> value) override;
863 // content::UrlFetcherDelegate overrides. 863 // content::UrlFetcherDelegate overrides.
864 virtual void OnURLFetchUploadProgress(const net::URLFetcher* source, 864 virtual void OnURLFetchUploadProgress(const net::URLFetcher* source,
865 int64 current, int64 total) OVERRIDE; 865 int64 current, int64 total) override;
866 866
867 private: 867 private:
868 const UploadRangeCallback callback_; 868 const UploadRangeCallback callback_;
869 const ProgressCallback progress_callback_; 869 const ProgressCallback progress_callback_;
870 870
871 DISALLOW_COPY_AND_ASSIGN(ResumeUploadRequest); 871 DISALLOW_COPY_AND_ASSIGN(ResumeUploadRequest);
872 }; 872 };
873 873
874 //========================== GetUploadStatusRequest ========================== 874 //========================== GetUploadStatusRequest ==========================
875 875
876 // Performs the request to fetch the current upload status of a file. 876 // Performs the request to fetch the current upload status of a file.
877 class GetUploadStatusRequest : public GetUploadStatusRequestBase { 877 class GetUploadStatusRequest : public GetUploadStatusRequestBase {
878 public: 878 public:
879 // See also GetUploadStatusRequestBase's comment for parameters meaning. 879 // See also GetUploadStatusRequestBase's comment for parameters meaning.
880 // |callback| must not be null. 880 // |callback| must not be null.
881 GetUploadStatusRequest(RequestSender* sender, 881 GetUploadStatusRequest(RequestSender* sender,
882 const GURL& upload_url, 882 const GURL& upload_url,
883 int64 content_length, 883 int64 content_length,
884 const UploadRangeCallback& callback); 884 const UploadRangeCallback& callback);
885 virtual ~GetUploadStatusRequest(); 885 virtual ~GetUploadStatusRequest();
886 886
887 protected: 887 protected:
888 // UploadRangeRequestBase overrides. 888 // UploadRangeRequestBase overrides.
889 virtual void OnRangeRequestComplete( 889 virtual void OnRangeRequestComplete(
890 const UploadRangeResponse& response, 890 const UploadRangeResponse& response,
891 scoped_ptr<base::Value> value) OVERRIDE; 891 scoped_ptr<base::Value> value) override;
892 892
893 private: 893 private:
894 const UploadRangeCallback callback_; 894 const UploadRangeCallback callback_;
895 895
896 DISALLOW_COPY_AND_ASSIGN(GetUploadStatusRequest); 896 DISALLOW_COPY_AND_ASSIGN(GetUploadStatusRequest);
897 }; 897 };
898 898
899 //========================== DownloadFileRequest ========================== 899 //========================== DownloadFileRequest ==========================
900 900
901 // This class performs the request for downloading of a specified file. 901 // This class performs the request for downloading of a specified file.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 const DriveApiUrlGenerator& url_generator, 940 const DriveApiUrlGenerator& url_generator,
941 const EntryActionCallback& callback); 941 const EntryActionCallback& callback);
942 virtual ~PermissionsInsertRequest(); 942 virtual ~PermissionsInsertRequest();
943 943
944 void set_id(const std::string& id) { id_ = id; } 944 void set_id(const std::string& id) { id_ = id; }
945 void set_type(PermissionType type) { type_ = type; } 945 void set_type(PermissionType type) { type_ = type; }
946 void set_role(PermissionRole role) { role_ = role; } 946 void set_role(PermissionRole role) { role_ = role; }
947 void set_value(const std::string& value) { value_ = value; } 947 void set_value(const std::string& value) { value_ = value; }
948 948
949 // UrlFetchRequestBase overrides. 949 // UrlFetchRequestBase overrides.
950 virtual GURL GetURL() const OVERRIDE; 950 virtual GURL GetURL() const override;
951 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; 951 virtual net::URLFetcher::RequestType GetRequestType() const override;
952 virtual bool GetContentData(std::string* upload_content_type, 952 virtual bool GetContentData(std::string* upload_content_type,
953 std::string* upload_content) OVERRIDE; 953 std::string* upload_content) override;
954 954
955 private: 955 private:
956 const DriveApiUrlGenerator url_generator_; 956 const DriveApiUrlGenerator url_generator_;
957 std::string id_; 957 std::string id_;
958 PermissionType type_; 958 PermissionType type_;
959 PermissionRole role_; 959 PermissionRole role_;
960 std::string value_; 960 std::string value_;
961 961
962 DISALLOW_COPY_AND_ASSIGN(PermissionsInsertRequest); 962 DISALLOW_COPY_AND_ASSIGN(PermissionsInsertRequest);
963 }; 963 };
964 964
965 } // namespace drive 965 } // namespace drive
966 } // namespace google_apis 966 } // namespace google_apis
967 967
968 #endif // GOOGLE_APIS_DRIVE_DRIVE_API_REQUESTS_H_ 968 #endif // GOOGLE_APIS_DRIVE_DRIVE_API_REQUESTS_H_
OLDNEW
« no previous file with comments | « google_apis/drive/base_requests_unittest.cc ('k') | google_apis/drive/drive_api_requests_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698