Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Side by Side Diff: sync/engine/net/url_translator.cc

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sync/engine/net/url_translator.h ('k') | sync/engine/non_blocking_type_commit_contribution.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 // Contains the definition of a few helper functions used for generating sync
6 // URLs.
7
8 #include "sync/engine/net/url_translator.h"
9
10 #include "net/base/escape.h"
11
12 using std::string;
13
14 namespace syncer {
15
16 namespace {
17 // Parameters that the server understands. (here, a-Z)
18 const char kParameterClient[] = "client";
19 const char kParameterClientID[] = "client_id";
20
21 #if defined(GOOGLE_CHROME_BUILD)
22 const char kClientName[] = "Google Chrome";
23 #else
24 const char kClientName[] = "Chromium";
25 #endif // defined(GOOGLE_CHROME_BUILD)
26 } // namespace
27
28 // Convenience wrappers around CgiEscapePath().
29 string CgiEscapeString(const char* src) {
30 return CgiEscapeString(string(src));
31 }
32
33 string CgiEscapeString(const string& src) {
34 return net::EscapeUrlEncodedData(src, true);
35 }
36
37 // This method appends the query string to the sync server path.
38 string MakeSyncServerPath(const string& path, const string& query_string) {
39 string result = path;
40 result.append("?");
41 result.append(query_string);
42 return result;
43 }
44
45 string MakeSyncQueryString(const string& client_id) {
46 string query;
47 query += kParameterClient;
48 query += "=" + CgiEscapeString(kClientName);
49 query += "&";
50 query += kParameterClientID;
51 query += "=" + CgiEscapeString(client_id);
52 return query;
53 }
54
55 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/engine/net/url_translator.h ('k') | sync/engine/non_blocking_type_commit_contribution.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698