OLD | NEW |
| (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 #ifndef CHROME_BROWSER_NET_BROWSER_URL_UTIL_H_ | |
6 #define CHROME_BROWSER_NET_BROWSER_URL_UTIL_H_ | |
7 #pragma once | |
8 | |
9 #include <string> | |
10 | |
11 class GURL; | |
12 | |
13 namespace ui { | |
14 class Clipboard; | |
15 } | |
16 | |
17 namespace chrome_browser_net { | |
18 | |
19 // Writes a string representation of |url| to the system clipboard. | |
20 void WriteURLToClipboard(const GURL& url, | |
21 const std::string& languages, | |
22 ui::Clipboard *clipboard); | |
23 | |
24 // Returns a new GURL by appending the given query parameter name and the | |
25 // value. Unsafe characters in the name and the value are escaped like | |
26 // %XX%XX. The original query component is preserved if it's present. | |
27 // | |
28 // Examples: | |
29 // | |
30 // AppendQueryParameter(GURL("http://example.com"), "name", "value").spec() | |
31 // => "http://example.com?name=value" | |
32 // AppendQueryParameter(GURL("http://example.com?x=y"), "name", "value").spec() | |
33 // => "http://example.com?x=y&name=value" | |
34 GURL AppendQueryParameter(const GURL& url, | |
35 const std::string& name, | |
36 const std::string& value); | |
37 | |
38 // Returns a new GURL by appending or replacing the given query parameter name | |
39 // and the value. If |name| appears more than once, only the first name-value | |
40 // pair is replaced. Unsafe characters in the name and the value are escaped | |
41 // like %XX%XX. The original query component is preserved if it's present. | |
42 // | |
43 // Examples: | |
44 // | |
45 // AppendOrReplaceQueryParameter( | |
46 // GURL("http://example.com"), "name", "new").spec() | |
47 // => "http://example.com?name=value" | |
48 // AppendOrReplaceQueryParameter( | |
49 // GURL("http://example.com?x=y&name=old"), "name", "new").spec() | |
50 // => "http://example.com?x=y&name=new" | |
51 GURL AppendOrReplaceQueryParameter(const GURL& url, | |
52 const std::string& name, | |
53 const std::string& value); | |
54 | |
55 } // namespace chrome_browser_net | |
56 | |
57 #endif // CHROME_BROWSER_NET_BROWSER_URL_UTIL_H_ | |
OLD | NEW |