| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 arraysize(kShadowColor) - 1, | 102 arraysize(kShadowColor) - 1, |
| 103 kShadowColor, | 103 kShadowColor, |
| 104 kShadowOffset, | 104 kShadowOffset, |
| 105 kShadowRadius); | 105 kShadowRadius); |
| 106 icon_view_->SetImage(shadowed_bitmap); | 106 icon_view_->SetImage(shadowed_bitmap); |
| 107 } | 107 } |
| 108 | 108 |
| 109 void LauncherButton::SetImage(const SkBitmap& image) { | 109 void LauncherButton::SetImage(const SkBitmap& image) { |
| 110 if (image.empty()) { | 110 if (image.empty()) { |
| 111 // TODO: need an empty image. | 111 // TODO: need an empty image. |
| 112 icon_view_->SetImage(&image); | 112 icon_view_->SetImage(image); |
| 113 return; | 113 return; |
| 114 } | 114 } |
| 115 | 115 |
| 116 if (icon_view_->icon_size() == 0) { | 116 if (icon_view_->icon_size() == 0) { |
| 117 SetShadowedImage(image); | 117 SetShadowedImage(image); |
| 118 return; | 118 return; |
| 119 } | 119 } |
| 120 | 120 |
| 121 // Resize the image maintaining our aspect ratio. | 121 // Resize the image maintaining our aspect ratio. |
| 122 int pref = icon_view_->icon_size(); | 122 int pref = icon_view_->icon_size(); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 int bar_id; | 257 int bar_id; |
| 258 bar_->SetVisible(true); | 258 bar_->SetVisible(true); |
| 259 | 259 |
| 260 if (state_ & STATE_HOVERED) | 260 if (state_ & STATE_HOVERED) |
| 261 bar_id = IDR_AURA_LAUNCHER_UNDERLINE_HOVER; | 261 bar_id = IDR_AURA_LAUNCHER_UNDERLINE_HOVER; |
| 262 else if (state_ & STATE_ACTIVE) | 262 else if (state_ & STATE_ACTIVE) |
| 263 bar_id = IDR_AURA_LAUNCHER_UNDERLINE_ACTIVE; | 263 bar_id = IDR_AURA_LAUNCHER_UNDERLINE_ACTIVE; |
| 264 else | 264 else |
| 265 bar_id = IDR_AURA_LAUNCHER_UNDERLINE_RUNNING; | 265 bar_id = IDR_AURA_LAUNCHER_UNDERLINE_RUNNING; |
| 266 | 266 |
| 267 bar_->SetImage(rb.GetImageNamed(bar_id).ToSkBitmap()); | 267 bar_->SetImage(rb.GetImageNamed(bar_id).ToImageSkia()); |
| 268 } | 268 } |
| 269 | 269 |
| 270 Layout(); | 270 Layout(); |
| 271 SchedulePaint(); | 271 SchedulePaint(); |
| 272 } | 272 } |
| 273 } // namespace internal | 273 } // namespace internal |
| 274 } // namespace ash | 274 } // namespace ash |
| OLD | NEW |