summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-06 22:25:55 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-06 22:25:55 +0000
commit8f1a633e90ac9bf4f959baeff321e35d5e031830 (patch)
treef7299b6d70e5cb0850d01ac3560fd064aaf25968 /chrome/browser
parent0dfeec38d00d53b6751a937e43394d6036987698 (diff)
downloadchromium_src-8f1a633e90ac9bf4f959baeff321e35d5e031830.zip
chromium_src-8f1a633e90ac9bf4f959baeff321e35d5e031830.tar.gz
chromium_src-8f1a633e90ac9bf4f959baeff321e35d5e031830.tar.bz2
Copy, Cut&Paste for chromeos
Not enabled for linux as ctrl-c/x/v may not be copy/cut/paste. See bug for details. BUG=18030 TEST=None Review URL: http://codereview.chromium.org/519068 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35655 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/browser.cc15
-rw-r--r--chrome/browser/browser.h2
-rw-r--r--chrome/browser/page_menu_model.cc3
-rw-r--r--chrome/browser/page_menu_model_unittest.cc3
4 files changed, 15 insertions, 8 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index bc72c9a..79c2308 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -97,6 +97,10 @@
#include "chrome/common/child_process_host.h"
#endif // OS_WIN
+#if defined(OS_CHROMEOS)
+#include "chrome/browser/automation/ui_controls.h"
+#endif
+
#if !defined(OS_MACOSX)
#include "chrome/browser/dock_info.h"
#endif
@@ -1106,7 +1110,7 @@ void Browser::OverrideEncoding(int encoding_id) {
}
}
-#if defined(OS_WIN)
+#if defined(OS_WIN) || defined(OS_CHROMEOS)
// 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
@@ -1115,6 +1119,11 @@ void Browser::OverrideEncoding(int encoding_id) {
// won't do anything. We'll need something like an overall clipboard command
// manager to do that.
+// TODO(oshima): Enabling this for chromeos, but not for linux. It's safe
+// to assume ctrl-x/c/v are cut, copy and paste on chromeos, but not on
+// linux. See http://crbug.com/18030. We should switch to whatever linux/gtk
+// will implement.
+
void Browser::Cut() {
UserMetrics::RecordAction("Cut", profile_);
ui_controls::SendKeyPress(window()->GetNativeHandle(), base::VKEY_X, true,
@@ -1132,7 +1141,7 @@ void Browser::Paste() {
ui_controls::SendKeyPress(window()->GetNativeHandle(), base::VKEY_V, true,
false, false);
}
-#endif // #if defined(OS_WIN)
+#endif // #if defined(OS_WIN) || defined(OS_CHROMEOS)
void Browser::Find() {
UserMetrics::RecordAction("Find", profile_);
@@ -1541,7 +1550,7 @@ void Browser::ExecuteCommandWithDisposition(
case IDC_ENCODING_WINDOWS1255:
case IDC_ENCODING_WINDOWS1258: OverrideEncoding(id); break;
-#if defined(OS_WIN)
+#if defined(OS_WIN) || defined(OS_CHROMEOS)
// Clipboard commands
case IDC_CUT: Cut(); break;
case IDC_COPY: Copy(); break;
diff --git a/chrome/browser/browser.h b/chrome/browser/browser.h
index d60ae4e..a354a62 100644
--- a/chrome/browser/browser.h
+++ b/chrome/browser/browser.h
@@ -383,7 +383,7 @@ class Browser : public TabStripModelDelegate,
void ToggleEncodingAutoDetect();
void OverrideEncoding(int encoding_id);
-#if defined(OS_WIN) || defined(OS_LINUX)
+#if defined(OS_WIN) || defined(OS_CHROMEOS)
// Clipboard commands
void Cut();
void Copy();
diff --git a/chrome/browser/page_menu_model.cc b/chrome/browser/page_menu_model.cc
index b33d076..e064d79 100644
--- a/chrome/browser/page_menu_model.cc
+++ b/chrome/browser/page_menu_model.cc
@@ -23,12 +23,11 @@ void PageMenuModel::Build() {
#if !defined(OS_CHROMEOS)
AddItemWithStringId(IDC_CREATE_SHORTCUTS, IDS_CREATE_SHORTCUTS);
AddSeparator();
- // TODO(davemoore) Implement cut / copy / paste
+#endif
AddItemWithStringId(IDC_CUT, IDS_CUT);
AddItemWithStringId(IDC_COPY, IDS_COPY);
AddItemWithStringId(IDC_PASTE, IDS_PASTE);
AddSeparator();
-#endif
AddItemWithStringId(IDC_FIND, IDS_FIND);
#if !defined(OS_CHROMEOS)
AddItemWithStringId(IDC_SAVE_PAGE, IDS_SAVE_PAGE);
diff --git a/chrome/browser/page_menu_model_unittest.cc b/chrome/browser/page_menu_model_unittest.cc
index 4ff1368..f63363e 100644
--- a/chrome/browser/page_menu_model_unittest.cc
+++ b/chrome/browser/page_menu_model_unittest.cc
@@ -20,8 +20,7 @@ TEST_F(PageMenuModelTest, Basics) {
// Verify it has items. The number varies by platform, so we don't check
// the exact number.
- // TODO(davemoore) cros only has 8 items right now.
- EXPECT_GT(itemCount, 7);
+ EXPECT_GT(itemCount, 10);
// Execute a couple of the items and make sure it gets back to our delegate.
// We can't use CountEnabledExecutable() here because the encoding menu's