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

Side by Side Diff: chrome/common/net/url_util.h

Issue 12069004: google_apis: Move AppendQueryParameter() etc. from common/net/url_util.h to net/base/url_util.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_COMMON_NET_URL_UTIL_H_ 5 #ifndef CHROME_COMMON_NET_URL_UTIL_H_
6 #define CHROME_COMMON_NET_URL_UTIL_H_ 6 #define CHROME_COMMON_NET_URL_UTIL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 class GURL; 10 class GURL;
11 11
12 namespace ui { 12 namespace ui {
13 class Clipboard; 13 class Clipboard;
14 } 14 }
15 15
16 namespace chrome_common_net { 16 namespace chrome_common_net {
17 17
18 // Writes a string representation of |url| to the system clipboard. 18 // Writes a string representation of |url| to the system clipboard.
19 void WriteURLToClipboard(const GURL& url, 19 void WriteURLToClipboard(const GURL& url,
20 const std::string& languages, 20 const std::string& languages,
21 ui::Clipboard *clipboard); 21 ui::Clipboard *clipboard);
22 22
23 // Returns a new GURL by appending the given query parameter name and the
24 // value. Unsafe characters in the name and the value are escaped like
25 // %XX%XX. The original query component is preserved if it's present.
26 //
27 // Examples:
28 //
29 // AppendQueryParameter(GURL("http://example.com"), "name", "value").spec()
30 // => "http://example.com?name=value"
31 // AppendQueryParameter(GURL("http://example.com?x=y"), "name", "value").spec()
32 // => "http://example.com?x=y&name=value"
33 GURL AppendQueryParameter(const GURL& url,
34 const std::string& name,
35 const std::string& value);
36
37 // Returns a new GURL by appending or replacing the given query parameter name
38 // and the value. If |name| appears more than once, only the first name-value
39 // pair is replaced. Unsafe characters in the name and the value are escaped
40 // like %XX%XX. The original query component is preserved if it's present.
41 //
42 // Examples:
43 //
44 // AppendOrReplaceQueryParameter(
45 // GURL("http://example.com"), "name", "new").spec()
46 // => "http://example.com?name=value"
47 // AppendOrReplaceQueryParameter(
48 // GURL("http://example.com?x=y&name=old"), "name", "new").spec()
49 // => "http://example.com?x=y&name=new"
50 GURL AppendOrReplaceQueryParameter(const GURL& url,
51 const std::string& name,
52 const std::string& value);
53
54 // Looks for |search_key| in the query portion of |url|. Returns true if the 23 // Looks for |search_key| in the query portion of |url|. Returns true if the
55 // key is found and sets |out_value| to the unescaped value for the key. 24 // key is found and sets |out_value| to the unescaped value for the key.
56 // Returns false if the key is not found. 25 // Returns false if the key is not found.
57 bool GetValueForKeyInQuery(const GURL& url, 26 bool GetValueForKeyInQuery(const GURL& url,
58 const std::string& search_key, 27 const std::string& search_key,
59 std::string* out_value); 28 std::string* out_value);
mmenke 2013/01/28 15:33:37 Think we should move this, too. It's a pretty nat
tfarina 2013/01/28 15:55:58 Done.
60 29
61 } // namespace chrome_common_net 30 } // namespace chrome_common_net
62 31
63 #endif // CHROME_COMMON_NET_URL_UTIL_H_ 32 #endif // CHROME_COMMON_NET_URL_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698