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.
5 // URL utility functions for Google Documents List API (aka WAPI).
7 #ifndef GOOGLE_APIS_DRIVE_GDATA_WAPI_URL_GENERATOR_H_
8 #define GOOGLE_APIS_DRIVE_GDATA_WAPI_URL_GENERATOR_H_
14 namespace google_apis
{
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
{
20 GDataWapiUrlGenerator(const GURL
& base_url
);
21 ~GDataWapiUrlGenerator();
23 // The base URL for communicating with the WAPI server for production.
24 static const char kBaseUrlForProduction
[];
26 // The base URL for the file download server for production.
27 static const char kBaseDownloadUrlForProduction
[];
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
);
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;
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
44 GURL
GenerateEditUrlWithoutParams(const std::string
& resource_id
) const;
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|
50 GURL
GenerateEditUrlWithEmbedOrigin(const std::string
& resource_id
,
51 const GURL
& embed_origin
) const;
57 } // namespace google_apis
59 #endif // GOOGLE_APIS_DRIVE_GDATA_WAPI_URL_GENERATOR_H_