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 command_updater_) { | |
Finnur
2014/12/03 10:49:17
This cannot possibly be correct. A cursory glance
| |
54 command_updater_->set_bookmark_icon_selected(true); | |
53 ExecuteCommand(EXECUTE_SOURCE_MOUSE); | 55 ExecuteCommand(EXECUTE_SOURCE_MOUSE); |
56 command_updater_->set_bookmark_icon_selected(false); | |
57 } | |
54 } | 58 } |
55 | 59 |
56 bool BubbleIconView::OnKeyPressed(const ui::KeyEvent& event) { | 60 bool BubbleIconView::OnKeyPressed(const ui::KeyEvent& event) { |
57 if (event.key_code() == ui::VKEY_SPACE || | 61 if (event.key_code() == ui::VKEY_SPACE || |
58 event.key_code() == ui::VKEY_RETURN) { | 62 event.key_code() == ui::VKEY_RETURN) { |
59 ExecuteCommand(EXECUTE_SOURCE_KEYBOARD); | 63 ExecuteCommand(EXECUTE_SOURCE_KEYBOARD); |
60 return true; | 64 return true; |
61 } | 65 } |
62 return false; | 66 return false; |
63 } | 67 } |
64 | 68 |
65 void BubbleIconView::OnGestureEvent(ui::GestureEvent* event) { | 69 void BubbleIconView::OnGestureEvent(ui::GestureEvent* event) { |
66 if (event->type() == ui::ET_GESTURE_TAP) { | 70 if (event->type() == ui::ET_GESTURE_TAP) { |
67 ExecuteCommand(EXECUTE_SOURCE_GESTURE); | 71 ExecuteCommand(EXECUTE_SOURCE_GESTURE); |
68 event->SetHandled(); | 72 event->SetHandled(); |
69 } | 73 } |
70 } | 74 } |
71 | 75 |
72 void BubbleIconView::ExecuteCommand(ExecuteSource source) { | 76 void BubbleIconView::ExecuteCommand(ExecuteSource source) { |
73 OnExecuting(source); | 77 OnExecuting(source); |
74 if (command_updater_) | 78 if (command_updater_) |
75 command_updater_->ExecuteCommand(command_id_); | 79 command_updater_->ExecuteCommand(command_id_); |
76 } | 80 } |
OLD | NEW |