| 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/gfx/canvas_skia.h" | 10 #include "ui/gfx/canvas_skia.h" |
| 11 | 11 |
| 12 namespace ash { | 12 namespace ash { |
| 13 | 13 |
| 14 namespace internal { | 14 namespace internal { |
| 15 | 15 |
| 16 const int kImageSize = 32; | 16 const int kImageSize = 32; |
| 17 | 17 |
| 18 AppLauncherButton::AppLauncherButton(views::ButtonListener* listener, | 18 AppLauncherButton::AppLauncherButton(views::ButtonListener* listener, |
| 19 LauncherButtonHost* host) | 19 LauncherButtonHost* host) |
| 20 : views::ImageButton(listener), | 20 : views::ImageButton(listener), |
| 21 host_(host) { | 21 host_(host) { |
| 22 SetImageAlignment(views::ImageButton::ALIGN_CENTER, | 22 SetImageAlignment(views::ImageButton::ALIGN_CENTER, |
| 23 views::ImageButton::ALIGN_MIDDLE); | 23 views::ImageButton::ALIGN_MIDDLE); |
| 24 set_focusable(true); |
| 24 } | 25 } |
| 25 | 26 |
| 26 AppLauncherButton::~AppLauncherButton() { | 27 AppLauncherButton::~AppLauncherButton() { |
| 27 } | 28 } |
| 28 | 29 |
| 29 void AppLauncherButton::SetAppImage(const SkBitmap& image) { | 30 void AppLauncherButton::SetAppImage(const SkBitmap& image) { |
| 30 if (image.empty()) { | 31 if (image.empty()) { |
| 31 // TODO: need an empty image. | 32 // TODO: need an empty image. |
| 32 SetImage(BS_NORMAL, &image); | 33 SetImage(BS_NORMAL, &image); |
| 33 return; | 34 return; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 return true; | 76 return true; |
| 76 } | 77 } |
| 77 | 78 |
| 78 void AppLauncherButton::OnMouseExited(const views::MouseEvent& event) { | 79 void AppLauncherButton::OnMouseExited(const views::MouseEvent& event) { |
| 79 ImageButton::OnMouseExited(event); | 80 ImageButton::OnMouseExited(event); |
| 80 host_->MouseExitedButton(this); | 81 host_->MouseExitedButton(this); |
| 81 } | 82 } |
| 82 | 83 |
| 83 } // namespace internal | 84 } // namespace internal |
| 84 } // namespace ash | 85 } // namespace ash |
| OLD | NEW |