OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_URL_GENERATOR_H_ | |
6 #define CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_URL_GENERATOR_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "url/gurl.h" | |
11 | |
12 namespace google_apis { | |
13 | |
14 // This class is used to generate URLs for communicating with drive api | |
15 // servers for production, and a local server for testing. | |
16 class DriveApiUrlGenerator { | |
17 public: | |
18 // |base_url| is the path to the target drive api server. | |
19 // Note that this is an injecting point for a testing server. | |
20 DriveApiUrlGenerator(const GURL& base_url, const GURL& base_download_url); | |
21 ~DriveApiUrlGenerator(); | |
22 | |
23 // The base URL for communicating with the production drive api server. | |
24 static const char kBaseUrlForProduction[]; | |
25 | |
26 // The base URL for the file download server for production. | |
27 static const char kBaseDownloadUrlForProduction[]; | |
28 | |
29 // Returns a URL to invoke "About: get" method. | |
30 GURL GetAboutGetUrl() const; | |
31 | |
32 // Returns a URL to invoke "Apps: list" method. | |
33 GURL GetAppsListUrl() const; | |
34 | |
35 // Returns a URL to fetch a file metadata. | |
36 GURL GetFilesGetUrl(const std::string& file_id) const; | |
37 | |
38 // Returns a URL to create a resource. | |
39 GURL GetFilesInsertUrl() const; | |
40 | |
41 // Returns a URL to patch file metadata. | |
42 GURL GetFilesPatchUrl(const std::string& file_id, | |
43 bool set_modified_date, | |
44 bool update_viewed_date) const; | |
45 | |
46 // Returns a URL to copy a resource specified by |file_id|. | |
47 GURL GetFilesCopyUrl(const std::string& file_id) const; | |
48 | |
49 // Returns a URL to fetch file list. | |
50 GURL GetFilesListUrl(int max_results, | |
51 const std::string& page_token, | |
52 const std::string& q) const; | |
53 | |
54 // Returns a URL to trash a resource with the given |file_id|. | |
55 GURL GetFilesTrashUrl(const std::string& file_id) const; | |
56 | |
57 // Returns a URL to fetch a list of changes. | |
58 GURL GetChangesListUrl(bool include_deleted, | |
59 int max_results, | |
60 const std::string& page_token, | |
61 int64 start_change_id) const; | |
62 | |
63 // Returns a URL to add a resource to a directory with |folder_id|. | |
64 GURL GetChildrenInsertUrl(const std::string& folder_id) const; | |
65 | |
66 // Returns a URL to remove a resource with |child_id| from a directory | |
67 // with |folder_id|. | |
68 GURL GetChildrenDeleteUrl(const std::string& child_id, | |
69 const std::string& folder_id) const; | |
70 | |
71 // Returns a URL to initiate uploading a new file. | |
72 GURL GetInitiateUploadNewFileUrl() const; | |
73 | |
74 // Returns a URL to initiate uploading an existing file specified by | |
75 // |resource_id|. | |
76 GURL GetInitiateUploadExistingFileUrl(const std::string& resource_id) const; | |
77 | |
78 // Generates a URL for downloading a file. | |
79 GURL GenerateDownloadFileUrl(const std::string& resource_id) const; | |
80 | |
81 private: | |
82 const GURL base_url_; | |
83 const GURL base_download_url_; | |
84 | |
85 // This class is copyable hence no DISALLOW_COPY_AND_ASSIGN here. | |
86 }; | |
87 | |
88 } // namespace google_apis | |
89 | |
90 #endif // CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_URL_GENERATOR_H_ | |
OLD | NEW |