diff options
author | peter@pcc.me.uk <peter@pcc.me.uk@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-22 04:54:27 +0000 |
---|---|---|
committer | peter@pcc.me.uk <peter@pcc.me.uk@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-22 04:54:27 +0000 |
commit | 764a0e0b02a63ed5674ef35c6ada46bb940e011b (patch) | |
tree | dd39b106dd12f0e8c0f7aff3a0a131a5f5ea573b /ui/views | |
parent | 669fe99e083d0c029f0bbb4d907e119eadc0c8a3 (diff) | |
download | chromium_src-764a0e0b02a63ed5674ef35c6ada46bb940e011b.zip chromium_src-764a0e0b02a63ed5674ef35c6ada46bb940e011b.tar.gz chromium_src-764a0e0b02a63ed5674ef35c6ada46bb940e011b.tar.bz2 |
Have ScopedClipboardWriter and Clipboard::WriteObjects take a buffer parameter.
GTK: add support for writing to primary selection (BUFFER_SELECTION).
BUG=none
TEST=ui_unittests
TBR=ananta
Review URL: http://codereview.chromium.org/9232075
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@122972 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views')
5 files changed, 14 insertions, 8 deletions
diff --git a/ui/views/controls/message_box_view.cc b/ui/views/controls/message_box_view.cc index 8e341ce..b675044 100644 --- a/ui/views/controls/message_box_view.cc +++ b/ui/views/controls/message_box_view.cc @@ -153,7 +153,7 @@ bool MessageBoxView::AcceleratorPressed(const ui::Accelerator& accelerator) { if (!clipboard) return false; - ui::ScopedClipboardWriter scw(clipboard); + ui::ScopedClipboardWriter scw(clipboard, ui::Clipboard::BUFFER_STANDARD); string16 text = message_labels_[0]->GetText(); for (size_t i = 1; i < message_labels_.size(); ++i) text += message_labels_[i]->GetText(); diff --git a/ui/views/controls/textfield/native_textfield_views_unittest.cc b/ui/views/controls/textfield/native_textfield_views_unittest.cc index 069b544..7fd6135 100644 --- a/ui/views/controls/textfield/native_textfield_views_unittest.cc +++ b/ui/views/controls/textfield/native_textfield_views_unittest.cc @@ -244,7 +244,8 @@ class NativeTextfieldViewsTest : public ViewsTestBase, void SetClipboardText(const std::string& text) { ui::ScopedClipboardWriter clipboard_writer( - views::ViewsDelegate::views_delegate->GetClipboard()); + views::ViewsDelegate::views_delegate->GetClipboard(), + ui::Clipboard::BUFFER_STANDARD); clipboard_writer.WriteText(ASCIIToUTF16(text)); } diff --git a/ui/views/controls/textfield/native_textfield_win.cc b/ui/views/controls/textfield/native_textfield_win.cc index 5257259..2f71a28 100644 --- a/ui/views/controls/textfield/native_textfield_win.cc +++ b/ui/views/controls/textfield/native_textfield_win.cc @@ -532,7 +532,8 @@ void NativeTextfieldWin::OnCopy() { const string16 text(GetSelectedText()); if (!text.empty() && ViewsDelegate::views_delegate) { ui::ScopedClipboardWriter scw( - ViewsDelegate::views_delegate->GetClipboard()); + ViewsDelegate::views_delegate->GetClipboard(), + ui::Clipboard::BUFFER_STANDARD); scw.WriteText(text); } } diff --git a/ui/views/controls/textfield/textfield_views_model.cc b/ui/views/controls/textfield/textfield_views_model.cc index d0fc8e0..6036485 100644 --- a/ui/views/controls/textfield/textfield_views_model.cc +++ b/ui/views/controls/textfield/textfield_views_model.cc @@ -499,8 +499,9 @@ bool TextfieldViewsModel::Redo() { bool TextfieldViewsModel::Cut() { if (!HasCompositionText() && HasSelection()) { - ui::ScopedClipboardWriter(views::ViewsDelegate::views_delegate - ->GetClipboard()).WriteText(GetSelectedText()); + ui::ScopedClipboardWriter( + views::ViewsDelegate::views_delegate->GetClipboard(), + ui::Clipboard::BUFFER_STANDARD).WriteText(GetSelectedText()); // A trick to let undo/redo handle cursor correctly. // Undoing CUT moves the cursor to the end of the change rather // than beginning, unlike Delete/Backspace. @@ -516,8 +517,9 @@ bool TextfieldViewsModel::Cut() { bool TextfieldViewsModel::Copy() { if (!HasCompositionText() && HasSelection()) { - ui::ScopedClipboardWriter(views::ViewsDelegate::views_delegate - ->GetClipboard()).WriteText(GetSelectedText()); + ui::ScopedClipboardWriter( + views::ViewsDelegate::views_delegate->GetClipboard(), + ui::Clipboard::BUFFER_STANDARD).WriteText(GetSelectedText()); return true; } return false; diff --git a/ui/views/controls/textfield/textfield_views_model_unittest.cc b/ui/views/controls/textfield/textfield_views_model_unittest.cc index d55bfcb..fa47061 100644 --- a/ui/views/controls/textfield/textfield_views_model_unittest.cc +++ b/ui/views/controls/textfield/textfield_views_model_unittest.cc @@ -495,7 +495,9 @@ TEST_F(TextfieldViewsModelTest, MAYBE_Clipboard) { ui::Clipboard* clipboard = views::ViewsDelegate::views_delegate->GetClipboard(); string16 initial_clipboard_text = ASCIIToUTF16("initial text"); - ui::ScopedClipboardWriter(clipboard).WriteText(initial_clipboard_text); + ui::ScopedClipboardWriter( + clipboard, + ui::Clipboard::BUFFER_STANDARD).WriteText(initial_clipboard_text); string16 clipboard_text; TextfieldViewsModel model(NULL); |