| 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() && |
| 53 HitTestPoint(gfx::ToFlooredPoint(event.location()))) { |
| 53 OnExecuting(EXECUTE_SOURCE_MOUSE); | 54 OnExecuting(EXECUTE_SOURCE_MOUSE); |
| 54 command_updater_->ExecuteCommand(command_id_); | 55 command_updater_->ExecuteCommand(command_id_); |
| 55 } | 56 } |
| 56 } | 57 } |
| 57 | 58 |
| 58 bool BubbleIconView::OnKeyPressed(const ui::KeyEvent& event) { | 59 bool BubbleIconView::OnKeyPressed(const ui::KeyEvent& event) { |
| 59 if (event.key_code() == ui::VKEY_SPACE || | 60 if (event.key_code() == ui::VKEY_SPACE || |
| 60 event.key_code() == ui::VKEY_RETURN) { | 61 event.key_code() == ui::VKEY_RETURN) { |
| 61 OnExecuting(EXECUTE_SOURCE_KEYBOARD); | 62 OnExecuting(EXECUTE_SOURCE_KEYBOARD); |
| 62 command_updater_->ExecuteCommand(command_id_); | 63 command_updater_->ExecuteCommand(command_id_); |
| 63 return true; | 64 return true; |
| 64 } | 65 } |
| 65 return false; | 66 return false; |
| 66 } | 67 } |
| 67 | 68 |
| 68 void BubbleIconView::OnGestureEvent(ui::GestureEvent* event) { | 69 void BubbleIconView::OnGestureEvent(ui::GestureEvent* event) { |
| 69 if (event->type() == ui::ET_GESTURE_TAP) { | 70 if (event->type() == ui::ET_GESTURE_TAP) { |
| 70 OnExecuting(EXECUTE_SOURCE_GESTURE); | 71 OnExecuting(EXECUTE_SOURCE_GESTURE); |
| 71 command_updater_->ExecuteCommand(command_id_); | 72 command_updater_->ExecuteCommand(command_id_); |
| 72 event->SetHandled(); | 73 event->SetHandled(); |
| 73 } | 74 } |
| 74 } | 75 } |
| OLD | NEW |