Chromium Code Reviews| 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 // If empty, the default production server is used. |
|
satorux1
2013/01/09 00:19:53
Let's not use the empty URL.
hidehiko
2013/01/09 04:47:37
Done.
| |
| 20 DriveApiUrlGenerator(); | 20 // Note that this is an injecting point for a testing server. |
| 21 explicit DriveApiUrlGenerator(const GURL& base_url); | |
| 21 ~DriveApiUrlGenerator(); | 22 ~DriveApiUrlGenerator(); |
| 22 | 23 |
| 23 // Returns a URL to fetch "about" data. | 24 // Returns a URL to fetch "about" data. |
| 24 GURL GetAboutUrl() const; | 25 GURL GetAboutUrl() const; |
| 25 | 26 |
| 26 // Returns a URL to fetch "applist" data. | 27 // Returns a URL to fetch "applist" data. |
| 27 GURL GetApplistUrl() const; | 28 GURL GetApplistUrl() const; |
| 28 | 29 |
| 29 // Returns a URL to fetch a list of changes. | 30 // Returns a URL to fetch a list of changes. |
| 30 // override_url: | 31 // override_url: |
| 31 // The base url for the fetch. If empty, the default url is used. | 32 // The base url for the fetch. If empty, the default url is used. |
| 32 // start_changestamp: | 33 // start_changestamp: |
| 33 // The starting point of the requesting change list, or 0 if all changes | 34 // The starting point of the requesting change list, or 0 if all changes |
| 34 // are necessary. | 35 // are necessary. |
| 35 GURL GetChangelistUrl( | 36 GURL GetChangelistUrl( |
| 36 const GURL& override_url, int64 start_changestamp) const; | 37 const GURL& override_url, int64 start_changestamp) const; |
| 37 | 38 |
| 38 // Returns a URL to fetch a list of files with the given |search_string|. | 39 // Returns a URL to fetch a list of files with the given |search_string|. |
| 39 // override_url: | 40 // override_url: |
| 40 // The base url for the fetching. If empty, the default url is used. | 41 // The base url for the fetching. If empty, the default url is used. |
| 41 // search_string: The search query. | 42 // search_string: The search query. |
| 42 GURL GetFilelistUrl( | 43 GURL GetFilelistUrl( |
| 43 const GURL& override_url, const std::string& search_string) const; | 44 const GURL& override_url, const std::string& search_string) const; |
| 44 | 45 |
| 45 // Returns a URL to fecth a file content. | 46 // Returns a URL to fecth a file content. |
| 46 GURL GetFileUrl(const std::string& file_id) const; | 47 GURL GetFileUrl(const std::string& file_id) const; |
| 47 | 48 |
| 49 private: | |
| 50 const GURL base_url_; | |
| 51 | |
| 48 // This class is copyable hence no DISALLOW_COPY_AND_ASSIGN here. | 52 // This class is copyable hence no DISALLOW_COPY_AND_ASSIGN here. |
| 49 }; | 53 }; |
| 50 | 54 |
| 51 } // namespace google_apis | 55 } // namespace google_apis |
| 52 | 56 |
| 53 #endif // CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_URL_GENERATOR_H_ | 57 #endif // CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_URL_GENERATOR_H_ |
| OLD | NEW |