diff options
author | suzhe@chromium.org <suzhe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-25 04:46:23 +0000 |
---|---|---|
committer | suzhe@chromium.org <suzhe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-25 04:46:23 +0000 |
commit | 20012dd4bc52c78aca5b0a17dec2150617c76f30 (patch) | |
tree | 135577e5684a210f0ac36801e208606b58b3706b /chrome/browser/views/frame | |
parent | 9e6069029b7a63c2a0235c92df22c811520fd47c (diff) | |
download | chromium_src-20012dd4bc52c78aca5b0a17dec2150617c76f30.zip chromium_src-20012dd4bc52c78aca5b0a17dec2150617c76f30.tar.gz chromium_src-20012dd4bc52c78aca5b0a17dec2150617c76f30.tar.bz2 |
[Linux]Implement Cut, Copy and Paste from page menu.
BUG=18030
TEST=The Cut, Copy and Paste commands in page menu should work in both web content and location bar.
Review URL: http://codereview.chromium.org/552125
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36989 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/frame')
-rw-r--r-- | chrome/browser/views/frame/browser_view.cc | 23 | ||||
-rw-r--r-- | chrome/browser/views/frame/browser_view.h | 3 |
2 files changed, 26 insertions, 0 deletions
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index 9cc01a3..e02d3d5 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -20,6 +20,7 @@ #include "build/build_config.h" #include "chrome/app/chrome_dll_resource.h" #include "chrome/browser/app_modal_dialog_queue.h" +#include "chrome/browser/automation/ui_controls.h" #include "chrome/browser/bookmarks/bookmark_utils.h" #include "chrome/browser/browser.h" #include "chrome/browser/browser_list.h" @@ -1183,6 +1184,28 @@ void BrowserView::ToggleCompactNavigationBar() { } #endif +// TODO(devint): http://b/issue?id=1117225 Cut, Copy, and Paste are always +// enabled in the page menu regardless of whether the command will do +// anything. When someone selects the menu item, we just act as if they hit +// the keyboard shortcut for the command by sending the associated key press +// to windows. The real fix to this bug is to disable the commands when they +// won't do anything. We'll need something like an overall clipboard command +// manager to do that. +void BrowserView::Cut() { + ui_controls::SendKeyPress(GetNativeHandle(), base::VKEY_X, true, + false, false); +} + +void BrowserView::Copy() { + ui_controls::SendKeyPress(GetNativeHandle(), base::VKEY_C, true, + false, false); +} + +void BrowserView::Paste() { + ui_controls::SendKeyPress(GetNativeHandle(), base::VKEY_V, true, + false, false); +} + /////////////////////////////////////////////////////////////////////////////// // BrowserView, BrowserWindowTesting implementation: diff --git a/chrome/browser/views/frame/browser_view.h b/chrome/browser/views/frame/browser_view.h index 2ba812a..516e9bf 100644 --- a/chrome/browser/views/frame/browser_view.h +++ b/chrome/browser/views/frame/browser_view.h @@ -292,6 +292,9 @@ class BrowserView : public BrowserWindow, #if defined(OS_CHROMEOS) virtual void ToggleCompactNavigationBar(); #endif // defined(OS_CHROMEOS) + virtual void Cut(); + virtual void Copy(); + virtual void Paste(); // Overridden from BrowserWindowTesting: virtual BookmarkBarView* GetBookmarkBarView() const; |