cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / sync / engine / net / url_translator.cc
blob285053af10f70782c121b7da13366d0cfc08ce82
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 // Contains the definition of a few helper functions used for generating sync
6 // URLs.
8 #include "sync/engine/net/url_translator.h"
10 #include "base/basictypes.h"
11 #include "net/base/escape.h"
13 using std::string;
15 namespace syncer {
17 namespace {
18 // Parameters that the server understands. (here, a-Z)
19 const char kParameterClient[] = "client";
20 const char kParameterClientID[] = "client_id";
22 #if defined(GOOGLE_CHROME_BUILD)
23 const char kClientName[] = "Google Chrome";
24 #else
25 const char kClientName[] = "Chromium";
26 #endif // defined(GOOGLE_CHROME_BUILD)
29 // Convenience wrappers around CgiEscapePath().
30 string CgiEscapeString(const char* src) {
31 return CgiEscapeString(string(src));
34 string CgiEscapeString(const string& src) {
35 return net::EscapeUrlEncodedData(src, true);
38 // This method appends the query string to the sync server path.
39 string MakeSyncServerPath(const string& path, const string& query_string) {
40 string result = path;
41 result.append("?");
42 result.append(query_string);
43 return result;
46 string MakeSyncQueryString(const string& client_id) {
47 string query;
48 query += kParameterClient;
49 query += "=" + CgiEscapeString(kClientName);
50 query += "&";
51 query += kParameterClientID;
52 query += "=" + CgiEscapeString(client_id);
53 return query;
56 } // namespace syncer