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 CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_URL_GENERATOR_H_ | 5 #ifndef CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_URL_GENERATOR_H_ |
6 #define CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_URL_GENERATOR_H_ | 6 #define CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_URL_GENERATOR_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
11 | 11 |
12 namespace google_apis { | 12 namespace google_apis { |
13 | 13 |
14 // This class is used to generate URLs for communicating with drive api | 14 // This class is used to generate URLs for communicating with drive api |
15 // servers for production, and a local server for testing. | 15 // servers for production, and a local server for testing. |
16 class DriveApiUrlGenerator { | 16 class DriveApiUrlGenerator { |
17 public: | 17 public: |
18 // TODO(hidehiko): Pass server name to a constructor in order to inject | 18 // |base_url| is the path to the target drive api server. |
19 // server path for testing. | 19 // Note that this is an injecting point for a testing server. |
20 DriveApiUrlGenerator(); | 20 explicit DriveApiUrlGenerator(const GURL& base_url); |
21 ~DriveApiUrlGenerator(); | 21 ~DriveApiUrlGenerator(); |
22 | 22 |
| 23 // The base URL for communicating with the production drive api server. |
| 24 static const char kBaseUrlForProduction[]; |
| 25 |
23 // Returns a URL to fetch "about" data. | 26 // Returns a URL to fetch "about" data. |
24 GURL GetAboutUrl() const; | 27 GURL GetAboutUrl() const; |
25 | 28 |
26 // Returns a URL to fetch "applist" data. | 29 // Returns a URL to fetch "applist" data. |
27 GURL GetApplistUrl() const; | 30 GURL GetApplistUrl() const; |
28 | 31 |
29 // Returns a URL to fetch a list of changes. | 32 // Returns a URL to fetch a list of changes. |
30 // override_url: | 33 // override_url: |
31 // The base url for the fetch. If empty, the default url is used. | 34 // The base url for the fetch. If empty, the default url is used. |
32 // start_changestamp: | 35 // start_changestamp: |
33 // The starting point of the requesting change list, or 0 if all changes | 36 // The starting point of the requesting change list, or 0 if all changes |
34 // are necessary. | 37 // are necessary. |
35 GURL GetChangelistUrl( | 38 GURL GetChangelistUrl( |
36 const GURL& override_url, int64 start_changestamp) const; | 39 const GURL& override_url, int64 start_changestamp) const; |
37 | 40 |
38 // Returns a URL to fetch a list of files with the given |search_string|. | 41 // Returns a URL to fetch a list of files with the given |search_string|. |
39 // override_url: | 42 // override_url: |
40 // The base url for the fetching. If empty, the default url is used. | 43 // The base url for the fetching. If empty, the default url is used. |
41 // search_string: The search query. | 44 // search_string: The search query. |
42 GURL GetFilelistUrl( | 45 GURL GetFilelistUrl( |
43 const GURL& override_url, const std::string& search_string) const; | 46 const GURL& override_url, const std::string& search_string) const; |
44 | 47 |
45 // Returns a URL to fecth a file content. | 48 // Returns a URL to fecth a file content. |
46 GURL GetFileUrl(const std::string& file_id) const; | 49 GURL GetFileUrl(const std::string& file_id) const; |
47 | 50 |
| 51 private: |
| 52 const GURL base_url_; |
| 53 |
48 // This class is copyable hence no DISALLOW_COPY_AND_ASSIGN here. | 54 // This class is copyable hence no DISALLOW_COPY_AND_ASSIGN here. |
49 }; | 55 }; |
50 | 56 |
51 } // namespace google_apis | 57 } // namespace google_apis |
52 | 58 |
53 #endif // CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_URL_GENERATOR_H_ | 59 #endif // CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_URL_GENERATOR_H_ |
OLD | NEW |