| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/tab_contents/render_view_context_menu.h" | 5 #include "chrome/browser/tab_contents/render_view_context_menu.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/clipboard.h" | 8 #include "base/clipboard.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/scoped_clipboard_writer.h" | 11 #include "base/scoped_clipboard_writer.h" |
| 12 #include "chrome/app/chrome_dll_resource.h" | 12 #include "chrome/app/chrome_dll_resource.h" |
| 13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/download/download_manager.h" | 14 #include "chrome/browser/download/download_manager.h" |
| 15 #include "chrome/browser/profile.h" | 15 #include "chrome/browser/profile.h" |
| 16 #include "chrome/browser/search_engines/template_url_model.h" | 16 #include "chrome/browser/search_engines/template_url_model.h" |
| 17 #include "chrome/browser/spellchecker.h" | 17 #include "chrome/browser/spellchecker.h" |
| 18 #include "chrome/browser/tab_contents/navigation_entry.h" | 18 #include "chrome/browser/tab_contents/navigation_entry.h" |
| 19 #include "chrome/browser/tab_contents/tab_contents.h" | 19 #include "chrome/browser/tab_contents/tab_contents.h" |
| 20 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
| 21 #include "chrome/common/platform_util.h" | 21 #include "chrome/common/platform_util.h" |
| 22 #include "chrome/common/pref_service.h" | 22 #include "chrome/common/pref_service.h" |
| 23 #include "chrome/common/url_constants.h" | 23 #include "chrome/common/url_constants.h" |
| 24 #include "grit/generated_resources.h" | 24 #include "grit/generated_resources.h" |
| 25 #include "net/base/escape.h" |
| 25 #include "net/base/net_util.h" | 26 #include "net/base/net_util.h" |
| 26 | 27 |
| 27 #if defined(OS_WIN) | 28 #if defined(OS_WIN) |
| 28 #include "chrome/browser/views/options/fonts_languages_window_view.h" | 29 #include "chrome/browser/views/options/fonts_languages_window_view.h" |
| 29 #include "chrome/browser/views/page_info_window.h" | 30 #include "chrome/browser/views/page_info_window.h" |
| 30 #endif | 31 #endif |
| 31 | 32 |
| 32 RenderViewContextMenu::RenderViewContextMenu( | 33 RenderViewContextMenu::RenderViewContextMenu( |
| 33 TabContents* tab_contents, | 34 TabContents* tab_contents, |
| 34 const ContextMenuParams& params) | 35 const ContextMenuParams& params) |
| (...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 } | 643 } |
| 643 | 644 |
| 644 void RenderViewContextMenu::WriteURLToClipboard(const GURL& url) { | 645 void RenderViewContextMenu::WriteURLToClipboard(const GURL& url) { |
| 645 std::string utf8_text = url.SchemeIs(chrome::kMailToScheme) ? url.path() : | 646 std::string utf8_text = url.SchemeIs(chrome::kMailToScheme) ? url.path() : |
| 646 // Unescaping path and query is not a good idea because other | 647 // Unescaping path and query is not a good idea because other |
| 647 // applications may not enocode non-ASCII characters in UTF-8. | 648 // applications may not enocode non-ASCII characters in UTF-8. |
| 648 // So the 4th parameter of net::FormatUrl() should be false. | 649 // So the 4th parameter of net::FormatUrl() should be false. |
| 649 // See crbug.com/2820. | 650 // See crbug.com/2820. |
| 650 WideToUTF8(net::FormatUrl( | 651 WideToUTF8(net::FormatUrl( |
| 651 url, profile_->GetPrefs()->GetString(prefs::kAcceptLanguages), | 652 url, profile_->GetPrefs()->GetString(prefs::kAcceptLanguages), |
| 652 false, false, NULL, NULL)); | 653 false, UnescapeRule::NONE, NULL, NULL)); |
| 653 | 654 |
| 654 WriteTextToClipboard(UTF8ToUTF16(utf8_text)); | 655 WriteTextToClipboard(UTF8ToUTF16(utf8_text)); |
| 655 DidWriteURLToClipboard(utf8_text); | 656 DidWriteURLToClipboard(utf8_text); |
| 656 } | 657 } |
| OLD | NEW |