OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2009 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. |
| 7 |
| 8 #include "chrome/browser/sync/engine/net/url_translator.h" |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "base/logging.h" |
| 12 #include "base/port.h" |
| 13 #include "chrome/browser/sync/util/character_set_converters.h" |
| 14 #include "net/base/escape.h" |
| 15 |
| 16 using std::string; |
| 17 |
| 18 namespace browser_sync { |
| 19 |
| 20 namespace { |
| 21 // Parameters that the server understands. (here, a-Z) |
| 22 const char kParameterAuthToken[] = "auth"; |
| 23 const char kParameterClientID[] = "client_id"; |
| 24 } |
| 25 |
| 26 // Convenience wrappers around CgiEscapePath(). |
| 27 string CgiEscapeString(const char* src) { |
| 28 return CgiEscapeString(string(src)); |
| 29 } |
| 30 |
| 31 string CgiEscapeString(const string& src) { |
| 32 return EscapePath(src); |
| 33 } |
| 34 |
| 35 // This method appends the query string to the sync server path. |
| 36 string MakeSyncServerPath(const string& path, const string& query_string) { |
| 37 string result = path; |
| 38 result.append("?"); |
| 39 result.append(query_string); |
| 40 return result; |
| 41 } |
| 42 |
| 43 string MakeSyncQueryString(const string& client_id) { |
| 44 string query; |
| 45 query += kParameterClientID; |
| 46 query += "=" + CgiEscapeString(client_id); |
| 47 return query; |
| 48 } |
| 49 |
| 50 } // namespace browser_sync |
OLD | NEW |