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

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: Address nits. 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/selection_controller.h » ('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 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 return views::Textfield::OnMousePressed(event); 665 return views::Textfield::OnMousePressed(event);
666 } 666 }
667 667
668 bool OmniboxViewViews::OnMouseDragged(const ui::MouseEvent& event) { 668 bool OmniboxViewViews::OnMouseDragged(const ui::MouseEvent& event) {
669 if (HasTextBeingDragged()) 669 if (HasTextBeingDragged())
670 CloseOmniboxPopup(); 670 CloseOmniboxPopup();
671 671
672 bool handled = views::Textfield::OnMouseDragged(event); 672 bool handled = views::Textfield::OnMouseDragged(event);
673 673
674 if (HasSelection() || 674 if (HasSelection() ||
675 ExceededDragThreshold(event.location() - last_click_location())) { 675 ExceededDragThreshold(event.location() - GetLastClickLocation())) {
676 select_all_on_mouse_release_ = false; 676 select_all_on_mouse_release_ = false;
677 } 677 }
678 678
679 return handled; 679 return handled;
680 } 680 }
681 681
682 void OmniboxViewViews::OnMouseReleased(const ui::MouseEvent& event) { 682 void OmniboxViewViews::OnMouseReleased(const ui::MouseEvent& event) {
683 views::Textfield::OnMouseReleased(event); 683 views::Textfield::OnMouseReleased(event);
684 // When the user has clicked and released to give us focus, select all. 684 // When the user has clicked and released to give us focus, select all.
685 if ((event.IsOnlyLeftMouseButton() || event.IsOnlyRightMouseButton()) && 685 if ((event.IsOnlyLeftMouseButton() || event.IsOnlyRightMouseButton()) &&
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
1074 paste_position + 1, IDS_PASTE_AND_GO, IDS_PASTE_AND_GO); 1074 paste_position + 1, IDS_PASTE_AND_GO, IDS_PASTE_AND_GO);
1075 1075
1076 menu_contents->AddSeparator(ui::NORMAL_SEPARATOR); 1076 menu_contents->AddSeparator(ui::NORMAL_SEPARATOR);
1077 1077
1078 // Minor note: We use IDC_ for command id here while the underlying textfield 1078 // Minor note: We use IDC_ for command id here while the underlying textfield
1079 // is using IDS_ for all its command ids. This is because views cannot depend 1079 // is using IDS_ for all its command ids. This is because views cannot depend
1080 // on IDC_ for now. 1080 // on IDC_ for now.
1081 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, 1081 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES,
1082 IDS_EDIT_SEARCH_ENGINES); 1082 IDS_EDIT_SEARCH_ENGINES);
1083 } 1083 }
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/render_text.h » ('j') | ui/views/selection_controller.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698