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

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

Issue 1171333003: Move net::FormatUrl and friends outside of //net and into //components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase again now that CQ is fixed Created 5 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 | « chrome/common/localized_error.cc ('k') | chrome/common/net/x509_certificate_model.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "chrome/common/net/url_util.h" 5 #include "chrome/common/net/url_util.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "components/url_formatter/url_formatter.h"
8 #include "net/base/escape.h" 9 #include "net/base/escape.h"
9 #include "net/base/net_util.h"
10 #include "ui/base/clipboard/scoped_clipboard_writer.h" 10 #include "ui/base/clipboard/scoped_clipboard_writer.h"
11 #include "url/gurl.h" 11 #include "url/gurl.h"
12 #include "url/url_constants.h" 12 #include "url/url_constants.h"
13 13
14 namespace chrome_common_net { 14 namespace chrome_common_net {
15 15
16 void WriteURLToClipboard(const GURL& url, const std::string& languages) { 16 void WriteURLToClipboard(const GURL& url, const std::string& languages) {
17 if (url.is_empty() || !url.is_valid()) 17 if (url.is_empty() || !url.is_valid())
18 return; 18 return;
19 19
20 // Unescaping path and query is not a good idea because other applications 20 // Unescaping path and query is not a good idea because other applications
21 // may not encode non-ASCII characters in UTF-8. See crbug.com/2820. 21 // may not encode non-ASCII characters in UTF-8. See crbug.com/2820.
22 base::string16 text = url.SchemeIs(url::kMailToScheme) ? 22 base::string16 text =
23 base::ASCIIToUTF16(url.path()) : 23 url.SchemeIs(url::kMailToScheme)
24 net::FormatUrl(url, languages, net::kFormatUrlOmitNothing, 24 ? base::ASCIIToUTF16(url.path())
25 net::UnescapeRule::NONE, NULL, NULL, NULL); 25 : url_formatter::FormatUrl(
26 url, languages, url_formatter::kFormatUrlOmitNothing,
27 net::UnescapeRule::NONE, nullptr, nullptr, nullptr);
26 28
27 ui::ScopedClipboardWriter scw(ui::CLIPBOARD_TYPE_COPY_PASTE); 29 ui::ScopedClipboardWriter scw(ui::CLIPBOARD_TYPE_COPY_PASTE);
28 scw.WriteURL(text); 30 scw.WriteURL(text);
29 } 31 }
30 32
31 } // namespace chrome_common_net 33 } // namespace chrome_common_net
OLDNEW
« no previous file with comments | « chrome/common/localized_error.cc ('k') | chrome/common/net/x509_certificate_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698