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

Side by Side Diff: net/base/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: unnamed namespace 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 2013 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 NET_BASE_URL_UTIL_H_
6 #define CHROME_COMMON_NET_URL_UTIL_H_ 6 #define NET_BASE_URL_UTIL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "net/base/net_export.h"
11
10 class GURL; 12 class GURL;
11 13
12 namespace ui { 14 namespace net {
13 class Clipboard;
14 }
15
16 namespace chrome_common_net {
17
18 // Writes a string representation of |url| to the system clipboard.
19 void WriteURLToClipboard(const GURL& url,
20 const std::string& languages,
21 ui::Clipboard *clipboard);
22 15
23 // Returns a new GURL by appending the given query parameter name and the 16 // 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 17 // 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. 18 // %XX%XX. The original query component is preserved if it's present.
26 // 19 //
27 // Examples: 20 // Examples:
28 // 21 //
29 // AppendQueryParameter(GURL("http://example.com"), "name", "value").spec() 22 // AppendQueryParameter(GURL("http://example.com"), "name", "value").spec()
30 // => "http://example.com?name=value" 23 // => "http://example.com?name=value"
31 // AppendQueryParameter(GURL("http://example.com?x=y"), "name", "value").spec() 24 // AppendQueryParameter(GURL("http://example.com?x=y"), "name", "value").spec()
32 // => "http://example.com?x=y&name=value" 25 // => "http://example.com?x=y&name=value"
33 GURL AppendQueryParameter(const GURL& url, 26 NET_EXPORT GURL AppendQueryParameter(const GURL& url,
34 const std::string& name, 27 const std::string& name,
35 const std::string& value); 28 const std::string& value);
36 29
37 // Returns a new GURL by appending or replacing the given query parameter name 30 // 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 31 // 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 32 // 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. 33 // like %XX%XX. The original query component is preserved if it's present.
41 // 34 //
42 // Examples: 35 // Examples:
43 // 36 //
44 // AppendOrReplaceQueryParameter( 37 // AppendOrReplaceQueryParameter(
45 // GURL("http://example.com"), "name", "new").spec() 38 // GURL("http://example.com"), "name", "new").spec()
46 // => "http://example.com?name=value" 39 // => "http://example.com?name=value"
47 // AppendOrReplaceQueryParameter( 40 // AppendOrReplaceQueryParameter(
48 // GURL("http://example.com?x=y&name=old"), "name", "new").spec() 41 // GURL("http://example.com?x=y&name=old"), "name", "new").spec()
49 // => "http://example.com?x=y&name=new" 42 // => "http://example.com?x=y&name=new"
50 GURL AppendOrReplaceQueryParameter(const GURL& url, 43 NET_EXPORT GURL AppendOrReplaceQueryParameter(const GURL& url,
51 const std::string& name, 44 const std::string& name,
52 const std::string& value); 45 const std::string& value);
53 46
54 // Looks for |search_key| in the query portion of |url|. Returns true if the 47 // 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. 48 // key is found and sets |out_value| to the unescaped value for the key.
56 // Returns false if the key is not found. 49 // Returns false if the key is not found.
57 bool GetValueForKeyInQuery(const GURL& url, 50 NET_EXPORT bool GetValueForKeyInQuery(const GURL& url,
58 const std::string& search_key, 51 const std::string& search_key,
59 std::string* out_value); 52 std::string* out_value);
60 53
61 } // namespace chrome_common_net 54 } // namespace net
62 55
63 #endif // CHROME_COMMON_NET_URL_UTIL_H_ 56 #endif // NET_BASE_URL_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698