OLD | NEW |
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 #include "chrome/browser/net/browser_url_util.h" | 5 #include "chrome/common/net/url_util.h" |
6 | 6 |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/common/url_constants.h" | 9 #include "chrome/common/url_constants.h" |
10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
11 #include "googleurl/src/url_parse.h" | 11 #include "googleurl/src/url_parse.h" |
12 #include "net/base/escape.h" | 12 #include "net/base/escape.h" |
13 #include "net/base/net_util.h" | 13 #include "net/base/net_util.h" |
14 #include "ui/base/clipboard/scoped_clipboard_writer.h" | 14 #include "ui/base/clipboard/scoped_clipboard_writer.h" |
15 | 15 |
16 namespace chrome_browser_net { | 16 namespace chrome_common_net { |
17 | 17 |
18 void WriteURLToClipboard(const GURL& url, | 18 void WriteURLToClipboard(const GURL& url, |
19 const std::string& languages, | 19 const std::string& languages, |
20 ui::Clipboard *clipboard) { | 20 ui::Clipboard *clipboard) { |
21 if (url.is_empty() || !url.is_valid() || !clipboard) | 21 if (url.is_empty() || !url.is_valid() || !clipboard) |
22 return; | 22 return; |
23 | 23 |
24 // Unescaping path and query is not a good idea because other applications | 24 // Unescaping path and query is not a good idea because other applications |
25 // may not encode non-ASCII characters in UTF-8. See crbug.com/2820. | 25 // may not encode non-ASCII characters in UTF-8. See crbug.com/2820. |
26 string16 text = url.SchemeIs(chrome::kMailToScheme) ? | 26 string16 text = url.SchemeIs(chrome::kMailToScheme) ? |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 if (!output.empty()) | 84 if (!output.empty()) |
85 output += "&"; | 85 output += "&"; |
86 | 86 |
87 output += (param_name + "=" + param_value); | 87 output += (param_name + "=" + param_value); |
88 } | 88 } |
89 GURL::Replacements replacements; | 89 GURL::Replacements replacements; |
90 replacements.SetQueryStr(output); | 90 replacements.SetQueryStr(output); |
91 return url.ReplaceComponents(replacements); | 91 return url.ReplaceComponents(replacements); |
92 } | 92 } |
93 | 93 |
94 } // namespace chrome_browser_net | 94 } // namespace chrome_common_net |
OLD | NEW |