| 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/common/system/tray/actionable_view.h" | 5 #include "ash/common/system/tray/actionable_view.h" |
| 6 | 6 |
| 7 #include "ash/common/ash_constants.h" | 7 #include "ash/common/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 |
| 11 namespace ash { | 11 namespace ash { |
| 12 | 12 |
| 13 // static | 13 // static |
| 14 const char ActionableView::kViewClassName[] = "tray/ActionableView"; | 14 const char ActionableView::kViewClassName[] = "tray/ActionableView"; |
| 15 | 15 |
| 16 ActionableView::ActionableView() | 16 ActionableView::ActionableView() : has_capture_(false) { |
| 17 : has_capture_(false) { | |
| 18 SetFocusBehavior(FocusBehavior::ALWAYS); | 17 SetFocusBehavior(FocusBehavior::ALWAYS); |
| 19 } | 18 } |
| 20 | 19 |
| 21 ActionableView::~ActionableView() { | 20 ActionableView::~ActionableView() {} |
| 22 } | |
| 23 | 21 |
| 24 void ActionableView::OnPaintFocus(gfx::Canvas* canvas) { | 22 void ActionableView::OnPaintFocus(gfx::Canvas* canvas) { |
| 25 gfx::Rect rect(GetFocusBounds()); | 23 gfx::Rect rect(GetFocusBounds()); |
| 26 rect.Inset(1, 1, 3, 2); | 24 rect.Inset(1, 1, 3, 2); |
| 27 canvas->DrawSolidFocusRect(rect, kFocusBorderColor); | 25 canvas->DrawSolidFocusRect(rect, kFocusBorderColor); |
| 28 } | 26 } |
| 29 | 27 |
| 30 gfx::Rect ActionableView::GetFocusBounds() { | 28 gfx::Rect ActionableView::GetFocusBounds() { |
| 31 return GetLocalBounds(); | 29 return GetLocalBounds(); |
| 32 } | 30 } |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 // We render differently when focused. | 82 // We render differently when focused. |
| 85 SchedulePaint(); | 83 SchedulePaint(); |
| 86 } | 84 } |
| 87 | 85 |
| 88 void ActionableView::OnGestureEvent(ui::GestureEvent* event) { | 86 void ActionableView::OnGestureEvent(ui::GestureEvent* event) { |
| 89 if (event->type() == ui::ET_GESTURE_TAP && PerformAction(*event)) | 87 if (event->type() == ui::ET_GESTURE_TAP && PerformAction(*event)) |
| 90 event->SetHandled(); | 88 event->SetHandled(); |
| 91 } | 89 } |
| 92 | 90 |
| 93 } // namespace ash | 91 } // namespace ash |
| OLD | NEW |