| 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/launcher/app_launcher_button.h" | 5 #include "ash/launcher/app_launcher_button.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/launcher/launcher_button_host.h" | 9 #include "ash/launcher/launcher_button_host.h" |
| 10 #include "ui/base/accessibility/accessible_view_state.h" | 10 #include "ui/base/accessibility/accessible_view_state.h" |
| 11 #include "ui/gfx/canvas_skia.h" | 11 #include "ui/gfx/canvas_skia.h" |
| 12 | 12 |
| 13 namespace ash { | 13 namespace ash { |
| 14 | 14 |
| 15 namespace internal { | 15 namespace internal { |
| 16 | 16 |
| 17 const int kImageSize = 32; | 17 const int kImageSize = 32; |
| 18 | 18 |
| 19 AppLauncherButton::AppLauncherButton(views::ButtonListener* listener, | 19 AppLauncherButton::AppLauncherButton(views::ButtonListener* listener, |
| 20 LauncherButtonHost* host) | 20 LauncherButtonHost* host) |
| 21 : views::ImageButton(listener), | 21 : views::ImageButton(listener), |
| 22 host_(host) { | 22 host_(host) { |
| 23 SetImageAlignment(views::ImageButton::ALIGN_CENTER, | 23 SetImageAlignment(views::ImageButton::ALIGN_CENTER, |
| 24 views::ImageButton::ALIGN_MIDDLE); | 24 views::ImageButton::ALIGN_MIDDLE); |
| 25 set_focusable(true); | 25 set_accessibility_focusable(true); |
| 26 } | 26 } |
| 27 | 27 |
| 28 AppLauncherButton::~AppLauncherButton() { | 28 AppLauncherButton::~AppLauncherButton() { |
| 29 } | 29 } |
| 30 | 30 |
| 31 void AppLauncherButton::SetAppImage(const SkBitmap& image) { | 31 void AppLauncherButton::SetAppImage(const SkBitmap& image) { |
| 32 if (image.empty()) { | 32 if (image.empty()) { |
| 33 // TODO: need an empty image. | 33 // TODO: need an empty image. |
| 34 SetImage(BS_NORMAL, &image); | 34 SetImage(BS_NORMAL, &image); |
| 35 return; | 35 return; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 host_->MouseExitedButton(this); | 82 host_->MouseExitedButton(this); |
| 83 } | 83 } |
| 84 | 84 |
| 85 void AppLauncherButton::GetAccessibleState(ui::AccessibleViewState* state) { | 85 void AppLauncherButton::GetAccessibleState(ui::AccessibleViewState* state) { |
| 86 state->role = ui::AccessibilityTypes::ROLE_PUSHBUTTON; | 86 state->role = ui::AccessibilityTypes::ROLE_PUSHBUTTON; |
| 87 state->name = host_->GetAccessibleName(this); | 87 state->name = host_->GetAccessibleName(this); |
| 88 } | 88 } |
| 89 | 89 |
| 90 } // namespace internal | 90 } // namespace internal |
| 91 } // namespace ash | 91 } // namespace ash |
| OLD | NEW |