| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/common/shelf/app_list_button.h" | 5 #include "ash/common/shelf/app_list_button.h" |
| 6 | 6 |
| 7 #include "ash/common/ash_constants.h" | 7 #include "ash/common/ash_constants.h" |
| 8 #include "ash/common/material_design/material_design_controller.h" | 8 #include "ash/common/material_design/material_design_controller.h" |
| 9 #include "ash/common/shelf/ink_drop_button_listener.h" | 9 #include "ash/common/shelf/ink_drop_button_listener.h" |
| 10 #include "ash/common/shelf/shelf_constants.h" | 10 #include "ash/common/shelf/shelf_constants.h" |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 (contents_bounds.height() - foreground_bounds.height()) / 2); | 191 (contents_bounds.height() - foreground_bounds.height()) / 2); |
| 192 foreground_bounds.set_y( | 192 foreground_bounds.set_y( |
| 193 (contents_bounds.width() - foreground_bounds.width()) / 2); | 193 (contents_bounds.width() - foreground_bounds.width()) / 2); |
| 194 } | 194 } |
| 195 canvas->DrawImageInt(foreground_image, foreground_bounds.x(), | 195 canvas->DrawImageInt(foreground_image, foreground_bounds.x(), |
| 196 foreground_bounds.y()); | 196 foreground_bounds.y()); |
| 197 } | 197 } |
| 198 | 198 |
| 199 void AppListButton::PaintAppListButton(gfx::Canvas* canvas, | 199 void AppListButton::PaintAppListButton(gfx::Canvas* canvas, |
| 200 const gfx::ImageSkia& foreground_image) { | 200 const gfx::ImageSkia& foreground_image) { |
| 201 int background_image_id = 0; | 201 int background_image_id = IDR_AURA_NOTIFICATION_BACKGROUND_NORMAL; |
| 202 | 202 |
| 203 if (WmShell::Get()->GetAppListTargetVisibility() || | 203 if (WmShell::Get()->GetAppListTargetVisibility() || |
| 204 draw_background_as_active_) { | 204 draw_background_as_active_) { |
| 205 background_image_id = IDR_AURA_NOTIFICATION_BACKGROUND_PRESSED; | 205 background_image_id = IDR_AURA_NOTIFICATION_BACKGROUND_PRESSED; |
| 206 } else { | 206 } else if (wm_shelf_->GetBackgroundType() == SHELF_BACKGROUND_MAXIMIZED) { |
| 207 if (wm_shelf_->IsDimmed()) { | 207 background_image_id = IDR_AURA_NOTIFICATION_BACKGROUND_ON_BLACK; |
| 208 background_image_id = IDR_AURA_NOTIFICATION_BACKGROUND_ON_BLACK; | |
| 209 } else { | |
| 210 background_image_id = IDR_AURA_NOTIFICATION_BACKGROUND_NORMAL; | |
| 211 } | |
| 212 } | 208 } |
| 213 | 209 |
| 214 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 210 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 215 gfx::ImageSkia background_image = | 211 gfx::ImageSkia background_image = |
| 216 *rb.GetImageNamed(background_image_id).ToImageSkia(); | 212 *rb.GetImageNamed(background_image_id).ToImageSkia(); |
| 217 gfx::Rect background_bounds(background_image.size()); | 213 gfx::Rect background_bounds(background_image.size()); |
| 218 ShelfAlignment alignment = wm_shelf_->GetAlignment(); | 214 ShelfAlignment alignment = wm_shelf_->GetAlignment(); |
| 219 gfx::Rect contents_bounds = GetContentsBounds(); | 215 gfx::Rect contents_bounds = GetContentsBounds(); |
| 220 | 216 |
| 221 if (alignment == SHELF_ALIGNMENT_LEFT) { | 217 if (alignment == SHELF_ALIGNMENT_LEFT) { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 } | 283 } |
| 288 | 284 |
| 289 void AppListButton::SetDrawBackgroundAsActive(bool draw_background_as_active) { | 285 void AppListButton::SetDrawBackgroundAsActive(bool draw_background_as_active) { |
| 290 if (draw_background_as_active_ == draw_background_as_active) | 286 if (draw_background_as_active_ == draw_background_as_active) |
| 291 return; | 287 return; |
| 292 draw_background_as_active_ = draw_background_as_active; | 288 draw_background_as_active_ = draw_background_as_active; |
| 293 SchedulePaint(); | 289 SchedulePaint(); |
| 294 } | 290 } |
| 295 | 291 |
| 296 } // namespace ash | 292 } // namespace ash |
| OLD | NEW |