| 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 "ash/common/system/tray/system_tray.h" |
| 9 #include "ash/common/system/tray/system_tray_item.h" |
| 8 #include "ui/accessibility/ax_view_state.h" | 10 #include "ui/accessibility/ax_view_state.h" |
| 9 #include "ui/gfx/canvas.h" | 11 #include "ui/gfx/canvas.h" |
| 10 | 12 |
| 11 namespace ash { | 13 namespace ash { |
| 12 | 14 |
| 13 // static | 15 // static |
| 14 const char ActionableView::kViewClassName[] = "tray/ActionableView"; | 16 const char ActionableView::kViewClassName[] = "tray/ActionableView"; |
| 15 | 17 |
| 16 ActionableView::ActionableView() : has_capture_(false) { | 18 ActionableView::ActionableView(SystemTrayItem* owner) |
| 19 : owner_(owner), has_capture_(false) { |
| 17 SetFocusBehavior(FocusBehavior::ALWAYS); | 20 SetFocusBehavior(FocusBehavior::ALWAYS); |
| 18 } | 21 } |
| 19 | 22 |
| 20 ActionableView::~ActionableView() {} | 23 ActionableView::~ActionableView() {} |
| 21 | 24 |
| 22 void ActionableView::OnPaintFocus(gfx::Canvas* canvas) { | 25 void ActionableView::OnPaintFocus(gfx::Canvas* canvas) { |
| 23 gfx::Rect rect(GetFocusBounds()); | 26 gfx::Rect rect(GetFocusBounds()); |
| 24 rect.Inset(1, 1, 3, 2); | 27 rect.Inset(1, 1, 3, 2); |
| 25 canvas->DrawSolidFocusRect(rect, kFocusBorderColor); | 28 canvas->DrawSolidFocusRect(rect, kFocusBorderColor); |
| 26 } | 29 } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 View::OnBlur(); | 84 View::OnBlur(); |
| 82 // We render differently when focused. | 85 // We render differently when focused. |
| 83 SchedulePaint(); | 86 SchedulePaint(); |
| 84 } | 87 } |
| 85 | 88 |
| 86 void ActionableView::OnGestureEvent(ui::GestureEvent* event) { | 89 void ActionableView::OnGestureEvent(ui::GestureEvent* event) { |
| 87 if (event->type() == ui::ET_GESTURE_TAP && PerformAction(*event)) | 90 if (event->type() == ui::ET_GESTURE_TAP && PerformAction(*event)) |
| 88 event->SetHandled(); | 91 event->SetHandled(); |
| 89 } | 92 } |
| 90 | 93 |
| 94 void ActionableView::CloseSystemBubble() { |
| 95 DCHECK(owner_); |
| 96 owner_->system_tray()->CloseSystemBubble(); |
| 97 } |
| 98 |
| 91 } // namespace ash | 99 } // namespace ash |
| OLD | NEW |