OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/location_bar/bubble_icon_view.h" | 5 #include "chrome/browser/ui/views/location_bar/bubble_icon_view.h" |
6 | 6 |
7 #include "chrome/browser/command_updater.h" | 7 #include "chrome/browser/command_updater.h" |
8 #include "ui/accessibility/ax_view_state.h" | 8 #include "ui/accessibility/ax_view_state.h" |
9 #include "ui/events/event.h" | 9 #include "ui/events/event.h" |
10 | 10 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 void BubbleIconView::OnMouseReleased(const ui::MouseEvent& event) { | 43 void BubbleIconView::OnMouseReleased(const ui::MouseEvent& event) { |
44 // If this is the second click on this view then the bubble was showing on the | 44 // If this is the second click on this view then the bubble was showing on the |
45 // mouse pressed event and is hidden now. Prevent the bubble from reshowing by | 45 // mouse pressed event and is hidden now. Prevent the bubble from reshowing by |
46 // doing nothing here. | 46 // doing nothing here. |
47 if (suppress_mouse_released_action_) { | 47 if (suppress_mouse_released_action_) { |
48 suppress_mouse_released_action_ = false; | 48 suppress_mouse_released_action_ = false; |
49 return; | 49 return; |
50 } | 50 } |
51 | 51 |
52 if (event.IsOnlyLeftMouseButton() && HitTestPoint(event.location())) { | 52 if (event.IsOnlyLeftMouseButton() && HitTestPoint(event.location())) |
53 OnExecuting(EXECUTE_SOURCE_MOUSE); | 53 ExecuteCommand(EXECUTE_SOURCE_MOUSE); |
54 command_updater_->ExecuteCommand(command_id_); | |
55 } | |
56 } | 54 } |
57 | 55 |
58 bool BubbleIconView::OnKeyPressed(const ui::KeyEvent& event) { | 56 bool BubbleIconView::OnKeyPressed(const ui::KeyEvent& event) { |
59 if (event.key_code() == ui::VKEY_SPACE || | 57 if (event.key_code() == ui::VKEY_SPACE || |
60 event.key_code() == ui::VKEY_RETURN) { | 58 event.key_code() == ui::VKEY_RETURN) { |
61 OnExecuting(EXECUTE_SOURCE_KEYBOARD); | 59 ExecuteCommand(EXECUTE_SOURCE_KEYBOARD); |
62 command_updater_->ExecuteCommand(command_id_); | |
63 return true; | 60 return true; |
64 } | 61 } |
65 return false; | 62 return false; |
66 } | 63 } |
67 | 64 |
68 void BubbleIconView::OnGestureEvent(ui::GestureEvent* event) { | 65 void BubbleIconView::OnGestureEvent(ui::GestureEvent* event) { |
69 if (event->type() == ui::ET_GESTURE_TAP) { | 66 if (event->type() == ui::ET_GESTURE_TAP) { |
70 OnExecuting(EXECUTE_SOURCE_GESTURE); | 67 ExecuteCommand(EXECUTE_SOURCE_GESTURE); |
71 command_updater_->ExecuteCommand(command_id_); | |
72 event->SetHandled(); | 68 event->SetHandled(); |
73 } | 69 } |
74 } | 70 } |
| 71 |
| 72 void BubbleIconView::ExecuteCommand(ExecuteSource source) { |
| 73 OnExecuting(source); |
| 74 if (command_updater_) |
| 75 command_updater_->ExecuteCommand(command_id_); |
| 76 } |
OLD | NEW |