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

Side by Side Diff: ui/views/controls/textfield/textfield.cc

Issue 558913003: Remove clipboard argument from ScopedClipboardWriter constructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't leak a clipboard on Windows Created 6 years, 3 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
« no previous file with comments | « ui/views/controls/message_box_view.cc ('k') | ui/views/controls/textfield/textfield_model.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/views/controls/textfield/textfield.h" 5 #include "ui/views/controls/textfield/textfield.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "ui/accessibility/ax_view_state.h" 10 #include "ui/accessibility/ax_view_state.h"
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 } 609 }
610 OnAfterUserAction(); 610 OnAfterUserAction();
611 } 611 }
612 612
613 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) 613 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
614 if (event.IsOnlyMiddleMouseButton()) { 614 if (event.IsOnlyMiddleMouseButton()) {
615 if (GetRenderText()->IsPointInSelection(event.location())) { 615 if (GetRenderText()->IsPointInSelection(event.location())) {
616 OnBeforeUserAction(); 616 OnBeforeUserAction();
617 ClearSelection(); 617 ClearSelection();
618 ui::ScopedClipboardWriter( 618 ui::ScopedClipboardWriter(
619 ui::Clipboard::GetForCurrentThread(),
620 ui::CLIPBOARD_TYPE_SELECTION).WriteText(base::string16()); 619 ui::CLIPBOARD_TYPE_SELECTION).WriteText(base::string16());
621 OnAfterUserAction(); 620 OnAfterUserAction();
622 } else if (!read_only()) { 621 } else if (!read_only()) {
623 PasteSelectionClipboard(event); 622 PasteSelectionClipboard(event);
624 } 623 }
625 } 624 }
626 #endif 625 #endif
627 } 626 }
628 627
629 return true; 628 return true;
(...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1784 ui::TouchSelectionController::create(this)); 1783 ui::TouchSelectionController::create(this));
1785 } 1784 }
1786 if (touch_selection_controller_) 1785 if (touch_selection_controller_)
1787 touch_selection_controller_->SelectionChanged(); 1786 touch_selection_controller_->SelectionChanged();
1788 } 1787 }
1789 1788
1790 void Textfield::UpdateSelectionClipboard() const { 1789 void Textfield::UpdateSelectionClipboard() const {
1791 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) 1790 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
1792 if (performing_user_action_ && HasSelection()) { 1791 if (performing_user_action_ && HasSelection()) {
1793 ui::ScopedClipboardWriter( 1792 ui::ScopedClipboardWriter(
1794 ui::Clipboard::GetForCurrentThread(),
1795 ui::CLIPBOARD_TYPE_SELECTION).WriteText(GetSelectedText()); 1793 ui::CLIPBOARD_TYPE_SELECTION).WriteText(GetSelectedText());
1796 if (controller_) 1794 if (controller_)
1797 controller_->OnAfterCutOrCopy(ui::CLIPBOARD_TYPE_SELECTION); 1795 controller_->OnAfterCutOrCopy(ui::CLIPBOARD_TYPE_SELECTION);
1798 } 1796 }
1799 #endif 1797 #endif
1800 } 1798 }
1801 1799
1802 void Textfield::PasteSelectionClipboard(const ui::MouseEvent& event) { 1800 void Textfield::PasteSelectionClipboard(const ui::MouseEvent& event) {
1803 DCHECK(event.IsOnlyMiddleMouseButton()); 1801 DCHECK(event.IsOnlyMiddleMouseButton());
1804 DCHECK(!read_only()); 1802 DCHECK(!read_only());
(...skipping 11 matching lines...) Expand all
1816 const size_t length = selection_clipboard_text.length(); 1814 const size_t length = selection_clipboard_text.length();
1817 range = gfx::Range(range.start() + length, range.end() + length); 1815 range = gfx::Range(range.start() + length, range.end() + length);
1818 } 1816 }
1819 model_->MoveCursorTo(gfx::SelectionModel(range, affinity)); 1817 model_->MoveCursorTo(gfx::SelectionModel(range, affinity));
1820 UpdateAfterChange(true, true); 1818 UpdateAfterChange(true, true);
1821 OnAfterUserAction(); 1819 OnAfterUserAction();
1822 } 1820 }
1823 } 1821 }
1824 1822
1825 } // namespace views 1823 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/message_box_view.cc ('k') | ui/views/controls/textfield/textfield_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698