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

Side by Side Diff: chrome/browser/ui/views/omnibox/omnibox_view_views.cc

Issue 2408623002: Views: Extract text selection code from Textfield. (Closed)
Patch Set: Changes to PasteSelectionClipboard Created 4 years, 2 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 | « no previous file | ui/gfx/render_text.h » ('j') | ui/views/controls/textfield/textfield.cc » ('J')
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 "chrome/browser/ui/views/omnibox/omnibox_view_views.h" 5 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 return views::Textfield::OnMousePressed(event); 666 return views::Textfield::OnMousePressed(event);
667 } 667 }
668 668
669 bool OmniboxViewViews::OnMouseDragged(const ui::MouseEvent& event) { 669 bool OmniboxViewViews::OnMouseDragged(const ui::MouseEvent& event) {
670 if (HasTextBeingDragged()) 670 if (HasTextBeingDragged())
671 CloseOmniboxPopup(); 671 CloseOmniboxPopup();
672 672
673 bool handled = views::Textfield::OnMouseDragged(event); 673 bool handled = views::Textfield::OnMouseDragged(event);
674 674
675 if (HasSelection() || 675 if (HasSelection() ||
676 ExceededDragThreshold(event.location() - last_click_location())) { 676 ExceededDragThreshold(event.location() - GetLastClickLocation())) {
677 select_all_on_mouse_release_ = false; 677 select_all_on_mouse_release_ = false;
678 } 678 }
679 679
680 return handled; 680 return handled;
681 } 681 }
682 682
683 void OmniboxViewViews::OnMouseReleased(const ui::MouseEvent& event) { 683 void OmniboxViewViews::OnMouseReleased(const ui::MouseEvent& event) {
684 views::Textfield::OnMouseReleased(event); 684 views::Textfield::OnMouseReleased(event);
685 // When the user has clicked and released to give us focus, select all. 685 // When the user has clicked and released to give us focus, select all.
686 if ((event.IsOnlyLeftMouseButton() || event.IsOnlyRightMouseButton()) && 686 if ((event.IsOnlyLeftMouseButton() || event.IsOnlyRightMouseButton()) &&
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
1075 paste_position + 1, IDS_PASTE_AND_GO, IDS_PASTE_AND_GO); 1075 paste_position + 1, IDS_PASTE_AND_GO, IDS_PASTE_AND_GO);
1076 1076
1077 menu_contents->AddSeparator(ui::NORMAL_SEPARATOR); 1077 menu_contents->AddSeparator(ui::NORMAL_SEPARATOR);
1078 1078
1079 // Minor note: We use IDC_ for command id here while the underlying textfield 1079 // Minor note: We use IDC_ for command id here while the underlying textfield
1080 // is using IDS_ for all its command ids. This is because views cannot depend 1080 // is using IDS_ for all its command ids. This is because views cannot depend
1081 // on IDC_ for now. 1081 // on IDC_ for now.
1082 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, 1082 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES,
1083 IDS_EDIT_SEARCH_ENGINES); 1083 IDS_EDIT_SEARCH_ENGINES);
1084 } 1084 }
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/render_text.h » ('j') | ui/views/controls/textfield/textfield.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698