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

Side by Side Diff: chrome/browser/net/browser_url_util.cc

Issue 1513023: Strips http from omnibox (and a couple of other places) (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 8 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/browser/net/browser_url_util.h"
6 6
7 #include "app/clipboard/scoped_clipboard_writer.h" 7 #include "app/clipboard/scoped_clipboard_writer.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/common/url_constants.h" 10 #include "chrome/common/url_constants.h"
11 #include "googleurl/src/gurl.h" 11 #include "googleurl/src/gurl.h"
12 #include "net/base/net_util.h" 12 #include "net/base/net_util.h"
13 13
14 namespace chrome_browser_net { 14 namespace chrome_browser_net {
15 15
16 void WriteURLToClipboard(const GURL& url, 16 void WriteURLToClipboard(const GURL& url,
17 const std::wstring& languages, 17 const std::wstring& languages,
18 Clipboard *clipboard) { 18 Clipboard *clipboard) {
19 if (url.is_empty() || !url.is_valid() || !clipboard) 19 if (url.is_empty() || !url.is_valid() || !clipboard)
20 return; 20 return;
21 21
22 // Unescaping path and query is not a good idea because other applications 22 // Unescaping path and query is not a good idea because other applications
23 // may not encode non-ASCII characters in UTF-8. See crbug.com/2820. 23 // may not encode non-ASCII characters in UTF-8. See crbug.com/2820.
24 string16 text = url.SchemeIs(chrome::kMailToScheme) ? 24 string16 text = url.SchemeIs(chrome::kMailToScheme) ?
25 ASCIIToUTF16(url.path()) : 25 ASCIIToUTF16(url.path()) :
26 WideToUTF16(net::FormatUrl(url, languages, false, UnescapeRule::NONE, 26 WideToUTF16(net::FormatUrl(url, languages, net::kFormatUrlOmitNothing,
27 NULL, NULL, NULL)); 27 UnescapeRule::NONE, NULL, NULL, NULL));
28 28
29 ScopedClipboardWriter scw(clipboard); 29 ScopedClipboardWriter scw(clipboard);
30 scw.WriteURL(text); 30 scw.WriteURL(text);
31 } 31 }
32 32
33 } // namespace chrome_browser_net 33 } // namespace chrome_browser_net
OLDNEW
« no previous file with comments | « chrome/browser/gtk/options/url_picker_dialog_gtk.cc ('k') | chrome/browser/net/url_fixer_upper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698