| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |