OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 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 // URL utility functions for Google Documents List API (aka WAPI). | |
6 | |
7 #ifndef GOOGLE_APIS_DRIVE_GDATA_WAPI_URL_GENERATOR_H_ | |
8 #define GOOGLE_APIS_DRIVE_GDATA_WAPI_URL_GENERATOR_H_ | |
9 | |
10 #include <string> | |
11 | |
12 #include "url/gurl.h" | |
13 | |
14 namespace google_apis { | |
15 | |
16 // The class is used to generate URLs for communicating with the WAPI server. | |
17 // for production, and the local server for testing. | |
18 class GDataWapiUrlGenerator { | |
19 public: | |
20 GDataWapiUrlGenerator(const GURL& base_url); | |
21 ~GDataWapiUrlGenerator(); | |
22 | |
23 // The base URL for communicating with the WAPI server for production. | |
24 static const char kBaseUrlForProduction[]; | |
25 | |
26 // The base URL for the file download server for production. | |
27 static const char kBaseDownloadUrlForProduction[]; | |
28 | |
29 // Adds additional parameters for API version, output content type and to | |
30 // show folders in the feed are added to document feed URLs. | |
31 static GURL AddStandardUrlParams(const GURL& url); | |
32 | |
33 // Generates a URL for getting or editing the resource entry of | |
34 // the given resource ID. | |
35 GURL GenerateEditUrl(const std::string& resource_id) const; | |
36 | |
37 // Generates a URL for getting or editing the resource entry of the | |
38 // given resource ID without query params. | |
39 // Note that, in order to access to the WAPI server, it is necessary to | |
40 // append some query parameters to the URL. GenerateEditUrl declared above | |
41 // should be used in such cases. This method is designed for constructing | |
42 // the data, such as xml element/attributes in request body containing | |
43 // edit urls. | |
44 GURL GenerateEditUrlWithoutParams(const std::string& resource_id) const; | |
45 | |
46 // Generates a URL for getting or editing the resource entry of the given | |
47 // resource ID with additionally passed embed origin. This is used to fetch | |
48 // share urls for the sharing dialog to be embedded with the |embed_origin| | |
49 // origin. | |
50 GURL GenerateEditUrlWithEmbedOrigin(const std::string& resource_id, | |
51 const GURL& embed_origin) const; | |
52 | |
53 private: | |
54 const GURL base_url_; | |
55 }; | |
56 | |
57 } // namespace google_apis | |
58 | |
59 #endif // GOOGLE_APIS_DRIVE_GDATA_WAPI_URL_GENERATOR_H_ | |
OLD | NEW |