| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "ash/system/tray/actionable_view.h" | 5 #include "ash/system/tray/actionable_view.h" |
| 6 | 6 |
| 7 #include "ash/ash_constants.h" | 7 #include "ash/ash_constants.h" |
| 8 #include "ui/accessibility/ax_view_state.h" | 8 #include "ui/accessibility/ax_view_state.h" |
| 9 #include "ui/gfx/canvas.h" | 9 #include "ui/gfx/canvas.h" |
| 10 | 10 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 return false; | 43 return false; |
| 44 } | 44 } |
| 45 | 45 |
| 46 bool ActionableView::OnMousePressed(const ui::MouseEvent& event) { | 46 bool ActionableView::OnMousePressed(const ui::MouseEvent& event) { |
| 47 // Return true so that this view starts capturing the events. | 47 // Return true so that this view starts capturing the events. |
| 48 has_capture_ = true; | 48 has_capture_ = true; |
| 49 return true; | 49 return true; |
| 50 } | 50 } |
| 51 | 51 |
| 52 void ActionableView::OnMouseReleased(const ui::MouseEvent& event) { | 52 void ActionableView::OnMouseReleased(const ui::MouseEvent& event) { |
| 53 if (has_capture_ && GetLocalBounds().Contains(event.location())) | 53 if (has_capture_ && |
| 54 GetLocalBounds().Contains(gfx::ToFlooredPoint(event.location()))) |
| 54 PerformAction(event); | 55 PerformAction(event); |
| 55 } | 56 } |
| 56 | 57 |
| 57 void ActionableView::OnMouseCaptureLost() { | 58 void ActionableView::OnMouseCaptureLost() { |
| 58 has_capture_ = false; | 59 has_capture_ = false; |
| 59 } | 60 } |
| 60 | 61 |
| 61 void ActionableView::SetAccessibleName(const base::string16& name) { | 62 void ActionableView::SetAccessibleName(const base::string16& name) { |
| 62 accessible_name_ = name; | 63 accessible_name_ = name; |
| 63 } | 64 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 84 // We render differently when focused. | 85 // We render differently when focused. |
| 85 SchedulePaint(); | 86 SchedulePaint(); |
| 86 } | 87 } |
| 87 | 88 |
| 88 void ActionableView::OnGestureEvent(ui::GestureEvent* event) { | 89 void ActionableView::OnGestureEvent(ui::GestureEvent* event) { |
| 89 if (event->type() == ui::ET_GESTURE_TAP && PerformAction(*event)) | 90 if (event->type() == ui::ET_GESTURE_TAP && PerformAction(*event)) |
| 90 event->SetHandled(); | 91 event->SetHandled(); |
| 91 } | 92 } |
| 92 | 93 |
| 93 } // namespace ash | 94 } // namespace ash |
| OLD | NEW |