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 // A class to specify team_drive_id and corpora parameters for Files:list. | |
19 class FilesListScope { | |
hashimoto
2017/05/26 09:09:19
Sorry, I couldn't understand why this needs to be
yamaguchi
2017/05/29 08:38:21
I think it can.
- corpora : enum
- team_drive_id :
hashimoto
2017/05/30 08:34:57
IMO the Drive API is already too complicated (it's
yamaguchi
2017/05/31 08:21:30
Thanks. Changed to use 2 args instead of a new cla
| |
20 public: | |
21 static FilesListScope kAllTeamDrives; | |
22 static FilesListScope kDefault; | |
23 static FilesListScope CreateForTeamDrive(const std::string& team_drive_id); | |
24 | |
25 const std::string& GetCorpusParam() const; | |
26 const std::string& GetTeamDriveId() const { return team_drive_id_; } | |
27 | |
28 private: | |
29 static std::string kDefaultAndAllTeamDrivesCorpus_; | |
30 static std::string kTeamDriveCorpus_; | |
31 static std::string kDefaultCorpus_; | |
32 | |
33 FilesListScope(bool all_team_drives, std::string team_drive_id) | |
34 : all_team_drives_(all_team_drives), team_drive_id_(team_drive_id) {} | |
35 bool all_team_drives_; | |
36 std::string team_drive_id_; | |
37 }; | |
38 | |
18 // This class is used to generate URLs for communicating with drive api | 39 // This class is used to generate URLs for communicating with drive api |
19 // servers for production, and a local server for testing. | 40 // servers for production, and a local server for testing. |
20 class DriveApiUrlGenerator { | 41 class DriveApiUrlGenerator { |
21 public: | 42 public: |
22 // |base_url| is the path to the target drive api server. | 43 // |base_url| is the path to the target drive api server. |
23 // Note that this is an injecting point for a testing server. | 44 // Note that this is an injecting point for a testing server. |
24 DriveApiUrlGenerator(const GURL& base_url, | 45 DriveApiUrlGenerator(const GURL& base_url, |
25 const GURL& base_thumbnail_url, | 46 const GURL& base_thumbnail_url, |
26 TeamDrivesIntegrationStatus team_drives_integration); | 47 TeamDrivesIntegrationStatus team_drives_integration); |
27 DriveApiUrlGenerator(const DriveApiUrlGenerator& src); | 48 DriveApiUrlGenerator(const DriveApiUrlGenerator& src); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
61 bool set_modified_date, | 82 bool set_modified_date, |
62 bool update_viewed_date) const; | 83 bool update_viewed_date) const; |
63 | 84 |
64 // Returns a URL to copy a resource specified by |file_id|. | 85 // Returns a URL to copy a resource specified by |file_id|. |
65 GURL GetFilesCopyUrl(const std::string& file_id, | 86 GURL GetFilesCopyUrl(const std::string& file_id, |
66 const std::string& visibility) const; | 87 const std::string& visibility) const; |
67 | 88 |
68 // Returns a URL to fetch file list. | 89 // Returns a URL to fetch file list. |
69 GURL GetFilesListUrl(int max_results, | 90 GURL GetFilesListUrl(int max_results, |
70 const std::string& page_token, | 91 const std::string& page_token, |
92 const FilesListScope& scope, | |
71 const std::string& q) const; | 93 const std::string& q) const; |
72 | 94 |
73 // Returns a URL to delete a resource with the given |file_id|. | 95 // Returns a URL to delete a resource with the given |file_id|. |
74 GURL GetFilesDeleteUrl(const std::string& file_id) const; | 96 GURL GetFilesDeleteUrl(const std::string& file_id) const; |
75 | 97 |
76 // Returns a URL to trash a resource with the given |file_id|. | 98 // Returns a URL to trash a resource with the given |file_id|. |
77 GURL GetFilesTrashUrl(const std::string& file_id) const; | 99 GURL GetFilesTrashUrl(const std::string& file_id) const; |
78 | 100 |
79 // Returns a URL to invoke "TeamDrives: list" method. | 101 // Returns a URL to invoke "TeamDrives: list" method. |
80 GURL GetTeamDriveListUrl(int max_results, | 102 GURL GetTeamDriveListUrl(int max_results, |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
135 const GURL base_download_url_; | 157 const GURL base_download_url_; |
136 const GURL base_thumbnail_url_; | 158 const GURL base_thumbnail_url_; |
137 const bool enable_team_drives_; | 159 const bool enable_team_drives_; |
138 | 160 |
139 // This class is copyable hence no DISALLOW_COPY_AND_ASSIGN here. | 161 // This class is copyable hence no DISALLOW_COPY_AND_ASSIGN here. |
140 }; | 162 }; |
141 | 163 |
142 } // namespace google_apis | 164 } // namespace google_apis |
143 | 165 |
144 #endif // GOOGLE_APIS_DRIVE_DRIVE_API_URL_GENERATOR_H_ | 166 #endif // GOOGLE_APIS_DRIVE_DRIVE_API_URL_GENERATOR_H_ |
OLD | NEW |