OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/tray_views.h" | 5 #include "ash/system/tray/tray_views.h" |
6 | 6 |
7 #include "ash/system/tray/tray_constants.h" | 7 #include "ash/system/tray/tray_constants.h" |
8 #include "ash/system/tray/tray_item_view.h" | 8 #include "ash/system/tray/tray_item_view.h" |
9 #include "grit/ash_strings.h" | 9 #include "grit/ash_strings.h" |
10 #include "grit/ui_resources.h" | 10 #include "grit/ui_resources.h" |
11 #include "ui/base/accessibility/accessible_view_state.h" | 11 #include "ui/base/accessibility/accessible_view_state.h" |
| 12 #include "ui/base/event.h" |
12 #include "ui/base/resource/resource_bundle.h" | 13 #include "ui/base/resource/resource_bundle.h" |
13 #include "ui/gfx/canvas.h" | 14 #include "ui/gfx/canvas.h" |
14 #include "ui/gfx/image/image.h" | 15 #include "ui/gfx/image/image.h" |
15 #include "ui/gfx/image/image_skia.h" | 16 #include "ui/gfx/image/image_skia.h" |
16 #include "ui/views/border.h" | 17 #include "ui/views/border.h" |
17 #include "ui/views/controls/button/image_button.h" | 18 #include "ui/views/controls/button/image_button.h" |
18 #include "ui/views/controls/label.h" | 19 #include "ui/views/controls/label.h" |
19 #include "ui/views/layout/box_layout.h" | 20 #include "ui/views/layout/box_layout.h" |
20 #include "ui/views/layout/fill_layout.h" | 21 #include "ui/views/layout/fill_layout.h" |
21 #include "ui/views/layout/grid_layout.h" | 22 #include "ui/views/layout/grid_layout.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 109 |
109 ActionableView::~ActionableView() { | 110 ActionableView::~ActionableView() { |
110 } | 111 } |
111 | 112 |
112 void ActionableView::DrawBorder(gfx::Canvas* canvas, const gfx::Rect& bounds) { | 113 void ActionableView::DrawBorder(gfx::Canvas* canvas, const gfx::Rect& bounds) { |
113 gfx::Rect rect = bounds; | 114 gfx::Rect rect = bounds; |
114 rect.Inset(1, 1, 3, 3); | 115 rect.Inset(1, 1, 3, 3); |
115 canvas->DrawRect(rect, kFocusBorderColor); | 116 canvas->DrawRect(rect, kFocusBorderColor); |
116 } | 117 } |
117 | 118 |
118 bool ActionableView::OnKeyPressed(const views::KeyEvent& event) { | 119 bool ActionableView::OnKeyPressed(const ui::KeyEvent& event) { |
119 if (event.key_code() == ui::VKEY_SPACE || | 120 if (event.key_code() == ui::VKEY_SPACE || |
120 event.key_code() == ui::VKEY_RETURN) { | 121 event.key_code() == ui::VKEY_RETURN) { |
121 return PerformAction(event); | 122 // TODO(beng): remove once views::Event is gone. |
| 123 views::MouseEvent synthetic_event( |
| 124 ui::ET_MOUSE_RELEASED, 0, 0, ui::EF_LEFT_MOUSE_BUTTON); |
| 125 return PerformAction(synthetic_event); |
122 } | 126 } |
123 return false; | 127 return false; |
124 } | 128 } |
125 | 129 |
126 bool ActionableView::OnMousePressed(const views::MouseEvent& event) { | 130 bool ActionableView::OnMousePressed(const views::MouseEvent& event) { |
127 // Return true so that this view starts capturing the events. | 131 // Return true so that this view starts capturing the events. |
128 has_capture_ = true; | 132 has_capture_ = true; |
129 return true; | 133 return true; |
130 } | 134 } |
131 | 135 |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 tray_view->set_border(views::Border::CreateEmptyBorder( | 652 tray_view->set_border(views::Border::CreateEmptyBorder( |
649 kTrayLabelItemVerticalPaddingVeriticalAlignment, | 653 kTrayLabelItemVerticalPaddingVeriticalAlignment, |
650 horizontal_padding, | 654 horizontal_padding, |
651 kTrayLabelItemVerticalPaddingVeriticalAlignment, | 655 kTrayLabelItemVerticalPaddingVeriticalAlignment, |
652 horizontal_padding)); | 656 horizontal_padding)); |
653 } | 657 } |
654 } | 658 } |
655 | 659 |
656 } // namespace internal | 660 } // namespace internal |
657 } // namespace ash | 661 } // namespace ash |
OLD | NEW |