| 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 CHROME_BROWSER_GOOGLE_APIS_GDATA_WAPI_URL_UTIL_H_ | |
| 8 #define CHROME_BROWSER_GOOGLE_APIS_GDATA_WAPI_URL_UTIL_H_ | |
| 9 | |
| 10 #include <string> | |
| 11 | |
| 12 #include "googleurl/src/gurl.h" | |
| 13 | |
| 14 namespace google_apis { | |
| 15 namespace gdata_wapi_url_util { | |
| 16 | |
| 17 // The base URL for communicating with the WAPI server for production. | |
| 18 extern const char kBaseUrlForProduction[]; | |
| 19 | |
| 20 // The base URL for communicating with the local test server for testing. | |
| 21 extern const char kBaseUrlForTesting[]; | |
| 22 | |
| 23 // Adds additional parameters for API version, output content type and to show | |
| 24 // folders in the feed are added to document feed URLs. | |
| 25 GURL AddStandardUrlParams(const GURL& url); | |
| 26 | |
| 27 // Adds additional parameters to metadata feed to include installed 3rd party | |
| 28 // applications. | |
| 29 GURL AddMetadataUrlParams(const GURL& url); | |
| 30 | |
| 31 // Adds additional parameters for API version, output content type and to show | |
| 32 // folders in the feed are added to document feed URLs. | |
| 33 // Optionally, adds start-index=... parameter if |changestamp| is non-zero, | |
| 34 // and adds q=... parameter if |search_string| is non-empty. | |
| 35 GURL AddFeedUrlParams(const GURL& url, | |
| 36 int num_items_to_fetch, | |
| 37 int changestamp, | |
| 38 const std::string& search_string); | |
| 39 | |
| 40 } // namespace gdata_wapi_url_util | |
| 41 | |
| 42 // TODO(satorux): Move the class to a separate file gdata_wapi_url_generator.h. | |
| 43 // | |
| 44 // The class is used to generate URLs for communicating with the WAPI server. | |
| 45 // for production, and the local server for testing. | |
| 46 class GDataWapiUrlGenerator { | |
| 47 public: | |
| 48 explicit GDataWapiUrlGenerator(const GURL& base_url); | |
| 49 ~GDataWapiUrlGenerator(); | |
| 50 | |
| 51 // Generates a URL for getting the documents list feed. | |
| 52 // | |
| 53 // override_url: | |
| 54 // By default, a hard-coded base URL of the WAPI server is used. | |
| 55 // The base URL can be overridden by |override_url|. | |
| 56 // This is used for handling continuation of feeds (2nd page and onward). | |
| 57 // | |
| 58 // start_changestamp | |
| 59 // If |start_changestamp| is 0, URL for a full feed is generated. | |
| 60 // If |start_changestamp| is non-zero, URL for a delta feed is generated. | |
| 61 // | |
| 62 // search_string | |
| 63 // If |search_string| is non-empty, q=... parameter is added, and | |
| 64 // max-results=... parameter is adjusted for a search. | |
| 65 // | |
| 66 // shared_with_me | |
| 67 // If |shared_with_me| is true, the base URL is changed to fetch the | |
| 68 // shared-with-me documents. | |
| 69 // | |
| 70 // directory_resource_id: | |
| 71 // If |directory_resource_id| is non-empty, a URL for fetching documents in | |
| 72 // a particular directory is generated. | |
| 73 // | |
| 74 GURL GenerateDocumentListUrl( | |
| 75 const GURL& override_url, | |
| 76 int start_changestamp, | |
| 77 const std::string& search_string, | |
| 78 bool shared_with_me, | |
| 79 const std::string& directory_resource_id) const; | |
| 80 | |
| 81 // Generates a URL for getting the document entry of the given resource ID. | |
| 82 GURL GenerateDocumentEntryUrl(const std::string& resource_id) const; | |
| 83 | |
| 84 // Generates a URL for getting the root document list feed. | |
| 85 // Used to make changes in the root directory (ex. create a directory in the | |
| 86 // root directory) | |
| 87 GURL GenerateDocumentListRootUrl() const; | |
| 88 | |
| 89 // Generates a URL for getting the account metadata feed. | |
| 90 GURL GenerateAccountMetadataUrl() const; | |
| 91 | |
| 92 private: | |
| 93 const GURL base_url_; | |
| 94 }; | |
| 95 | |
| 96 } // namespace google_apis | |
| 97 | |
| 98 #endif // CHROME_BROWSER_GOOGLE_APIS_GDATA_WAPI_URL_UTIL_H_ | |
| OLD | NEW |