OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_URL_GENERATOR_H_ | 5 #ifndef GOOGLE_APIS_DRIVE_DRIVE_API_URL_GENERATOR_H_ |
6 #define GOOGLE_APIS_DRIVE_DRIVE_API_URL_GENERATOR_H_ | 6 #define GOOGLE_APIS_DRIVE_DRIVE_API_URL_GENERATOR_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "google_apis/drive/drive_switches.h" | 13 #include "google_apis/drive/drive_switches.h" |
14 #include "url/gurl.h" | 14 #include "url/gurl.h" |
15 | 15 |
16 namespace google_apis { | 16 namespace google_apis { |
17 | 17 |
18 enum FilesListCorpora { | |
19 CORPORA_DEFAULT, | |
20 CORPORA_TEAM_DRIVE, | |
21 CORPORA_ALL_TEAM_DRIVES, | |
22 }; | |
23 | |
18 // This class is used to generate URLs for communicating with drive api | 24 // This class is used to generate URLs for communicating with drive api |
19 // servers for production, and a local server for testing. | 25 // servers for production, and a local server for testing. |
20 class DriveApiUrlGenerator { | 26 class DriveApiUrlGenerator { |
21 public: | 27 public: |
22 // |base_url| is the path to the target drive api server. | 28 // |base_url| is the path to the target drive api server. |
23 // Note that this is an injecting point for a testing server. | 29 // Note that this is an injecting point for a testing server. |
24 DriveApiUrlGenerator(const GURL& base_url, | 30 DriveApiUrlGenerator(const GURL& base_url, |
25 const GURL& base_thumbnail_url, | 31 const GURL& base_thumbnail_url, |
26 TeamDrivesIntegrationStatus team_drives_integration); | 32 TeamDrivesIntegrationStatus team_drives_integration); |
27 DriveApiUrlGenerator(const DriveApiUrlGenerator& src); | 33 DriveApiUrlGenerator(const DriveApiUrlGenerator& src); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
61 bool set_modified_date, | 67 bool set_modified_date, |
62 bool update_viewed_date) const; | 68 bool update_viewed_date) const; |
63 | 69 |
64 // Returns a URL to copy a resource specified by |file_id|. | 70 // Returns a URL to copy a resource specified by |file_id|. |
65 GURL GetFilesCopyUrl(const std::string& file_id, | 71 GURL GetFilesCopyUrl(const std::string& file_id, |
66 const std::string& visibility) const; | 72 const std::string& visibility) const; |
67 | 73 |
68 // Returns a URL to fetch file list. | 74 // Returns a URL to fetch file list. |
69 GURL GetFilesListUrl(int max_results, | 75 GURL GetFilesListUrl(int max_results, |
70 const std::string& page_token, | 76 const std::string& page_token, |
77 FilesListCorpora corpora, | |
hashimoto
2017/06/02 09:44:46
How about moving FilesListCorpora enum to drive_ap
yamaguchi
2017/06/02 12:04:01
I think it'd be better to have this parameter an e
| |
78 const std::string& team_drive_id, | |
71 const std::string& q) const; | 79 const std::string& q) const; |
72 | 80 |
73 // Returns a URL to delete a resource with the given |file_id|. | 81 // Returns a URL to delete a resource with the given |file_id|. |
74 GURL GetFilesDeleteUrl(const std::string& file_id) const; | 82 GURL GetFilesDeleteUrl(const std::string& file_id) const; |
75 | 83 |
76 // Returns a URL to trash a resource with the given |file_id|. | 84 // Returns a URL to trash a resource with the given |file_id|. |
77 GURL GetFilesTrashUrl(const std::string& file_id) const; | 85 GURL GetFilesTrashUrl(const std::string& file_id) const; |
78 | 86 |
79 // Returns a URL to invoke "TeamDrives: list" method. | 87 // Returns a URL to invoke "TeamDrives: list" method. |
80 GURL GetTeamDriveListUrl(int max_results, | 88 GURL GetTeamDriveListUrl(int max_results, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
124 // true to get a cropped thumbnail in the dimensions. | 132 // true to get a cropped thumbnail in the dimensions. |
125 GURL GetThumbnailUrl(const std::string& resource_id, | 133 GURL GetThumbnailUrl(const std::string& resource_id, |
126 int width, | 134 int width, |
127 int height, | 135 int height, |
128 bool crop) const; | 136 bool crop) const; |
129 | 137 |
130 // Generates a URL for batch upload. | 138 // Generates a URL for batch upload. |
131 GURL GetBatchUploadUrl() const; | 139 GURL GetBatchUploadUrl() const; |
132 | 140 |
133 private: | 141 private: |
142 static const char* GetCorporaString_(FilesListCorpora corpora); | |
hashimoto
2017/06/02 09:44:46
This should be a free function in an unnamed names
yamaguchi
2017/06/02 12:04:01
Done.
| |
134 const GURL base_url_; | 143 const GURL base_url_; |
135 const GURL base_download_url_; | 144 const GURL base_download_url_; |
136 const GURL base_thumbnail_url_; | 145 const GURL base_thumbnail_url_; |
137 const bool enable_team_drives_; | 146 const bool enable_team_drives_; |
138 | 147 |
139 // This class is copyable hence no DISALLOW_COPY_AND_ASSIGN here. | 148 // This class is copyable hence no DISALLOW_COPY_AND_ASSIGN here. |
140 }; | 149 }; |
141 | 150 |
142 } // namespace google_apis | 151 } // namespace google_apis |
143 | 152 |
144 #endif // GOOGLE_APIS_DRIVE_DRIVE_API_URL_GENERATOR_H_ | 153 #endif // GOOGLE_APIS_DRIVE_DRIVE_API_URL_GENERATOR_H_ |
OLD | NEW |