| 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/launcher_button.h" | 5 #include "ash/launcher/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 "grit/ui_resources.h" | 10 #include "grit/ui_resources.h" |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 arraysize(kShadowColor) - 1, | 143 arraysize(kShadowColor) - 1, |
| 144 kShadowColor, | 144 kShadowColor, |
| 145 kShadowOffset, | 145 kShadowOffset, |
| 146 kShadowRadius); | 146 kShadowRadius); |
| 147 icon_view_->SetImage(shadowed_bitmap); | 147 icon_view_->SetImage(shadowed_bitmap); |
| 148 } | 148 } |
| 149 | 149 |
| 150 void LauncherButton::SetImage(const SkBitmap& image) { | 150 void LauncherButton::SetImage(const SkBitmap& image) { |
| 151 if (image.empty()) { | 151 if (image.empty()) { |
| 152 // TODO: need an empty image. | 152 // TODO: need an empty image. |
| 153 icon_view_->SetImage(&image); | 153 icon_view_->SetImage(image); |
| 154 return; | 154 return; |
| 155 } | 155 } |
| 156 | 156 |
| 157 if (icon_view_->icon_size() == 0) { | 157 if (icon_view_->icon_size() == 0) { |
| 158 SetShadowedImage(image); | 158 SetShadowedImage(image); |
| 159 return; | 159 return; |
| 160 } | 160 } |
| 161 | 161 |
| 162 // Resize the image maintaining our aspect ratio. | 162 // Resize the image maintaining our aspect ratio. |
| 163 int pref = icon_view_->icon_size(); | 163 int pref = icon_view_->icon_size(); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 int bar_id; | 302 int bar_id; |
| 303 bar_->SetVisible(true); | 303 bar_->SetVisible(true); |
| 304 | 304 |
| 305 if (state_ & STATE_ACTIVE || state_ & STATE_ATTENTION) | 305 if (state_ & STATE_ACTIVE || state_ & STATE_ATTENTION) |
| 306 bar_id = IDR_AURA_LAUNCHER_UNDERLINE_ACTIVE; | 306 bar_id = IDR_AURA_LAUNCHER_UNDERLINE_ACTIVE; |
| 307 else if (state_ & STATE_HOVERED) | 307 else if (state_ & STATE_HOVERED) |
| 308 bar_id = IDR_AURA_LAUNCHER_UNDERLINE_HOVER; | 308 bar_id = IDR_AURA_LAUNCHER_UNDERLINE_HOVER; |
| 309 else | 309 else |
| 310 bar_id = IDR_AURA_LAUNCHER_UNDERLINE_RUNNING; | 310 bar_id = IDR_AURA_LAUNCHER_UNDERLINE_RUNNING; |
| 311 | 311 |
| 312 bar_->SetImage(rb.GetImageNamed(bar_id).ToSkBitmap()); | 312 bar_->SetImage(rb.GetImageNamed(bar_id).ToImageSkia()); |
| 313 } | 313 } |
| 314 | 314 |
| 315 Layout(); | 315 Layout(); |
| 316 SchedulePaint(); | 316 SchedulePaint(); |
| 317 } | 317 } |
| 318 } // namespace internal | 318 } // namespace internal |
| 319 } // namespace ash | 319 } // namespace ash |
| OLD | NEW |