This source file includes following definitions.
- CgiEscapeString
- CgiEscapeString
- MakeSyncServerPath
- MakeSyncQueryString
#include "sync/engine/net/url_translator.h"
#include "base/basictypes.h"
#include "base/port.h"
#include "net/base/escape.h"
using std::string;
namespace syncer {
namespace {
const char kParameterClient[] = "client";
const char kParameterClientID[] = "client_id";
#if defined(GOOGLE_CHROME_BUILD)
const char kClientName[] = "Google Chrome";
#else
const char kClientName[] = "Chromium";
#endif
}
string CgiEscapeString(const char* src) {
return CgiEscapeString(string(src));
}
string CgiEscapeString(const string& src) {
return net::EscapeUrlEncodedData(src, true);
}
string MakeSyncServerPath(const string& path, const string& query_string) {
string result = path;
result.append("?");
result.append(query_string);
return result;
}
string MakeSyncQueryString(const string& client_id) {
string query;
query += kParameterClient;
query += "=" + CgiEscapeString(kClientName);
query += "&";
query += kParameterClientID;
query += "=" + CgiEscapeString(client_id);
return query;
}
}