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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 canvas->DrawCircle(circle_center, radius, fg_paint); | 186 canvas->DrawCircle(circle_center, radius, fg_paint); |
187 } | 187 } |
188 | 188 |
189 void AppListButton::PaintAppListButton(gfx::Canvas* canvas, | 189 void AppListButton::PaintAppListButton(gfx::Canvas* canvas, |
190 const gfx::ImageSkia& foreground_image) { | 190 const gfx::ImageSkia& foreground_image) { |
191 int background_image_id = 0; | 191 int background_image_id = 0; |
192 | 192 |
193 if (WmShell::Get()->GetAppListTargetVisibility() || | 193 if (WmShell::Get()->GetAppListTargetVisibility() || |
194 draw_background_as_active_) { | 194 draw_background_as_active_) { |
195 background_image_id = IDR_AURA_LAUNCHER_BACKGROUND_PRESSED; | 195 background_image_id = IDR_AURA_LAUNCHER_BACKGROUND_PRESSED; |
196 } else if (wm_shelf_->IsDimmed()) { | |
197 background_image_id = IDR_AURA_LAUNCHER_BACKGROUND_ON_BLACK; | |
198 } else { | 196 } else { |
199 background_image_id = IDR_AURA_LAUNCHER_BACKGROUND_NORMAL; | 197 background_image_id = IDR_AURA_LAUNCHER_BACKGROUND_NORMAL; |
200 } | 198 } |
201 | 199 |
202 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 200 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
203 gfx::ImageSkia background_image = | 201 gfx::ImageSkia background_image = |
204 *rb.GetImageNamed(background_image_id).ToImageSkia(); | 202 *rb.GetImageNamed(background_image_id).ToImageSkia(); |
205 gfx::Rect background_bounds(background_image.size()); | 203 gfx::Rect background_bounds(background_image.size()); |
206 ShelfAlignment alignment = wm_shelf_->GetAlignment(); | 204 ShelfAlignment alignment = wm_shelf_->GetAlignment(); |
207 gfx::Rect contents_bounds = GetContentsBounds(); | 205 gfx::Rect contents_bounds = GetContentsBounds(); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 int center = std::max(width(), height()) / 2.f; | 293 int center = std::max(width(), height()) / 2.f; |
296 gfx::Point centroid(center, center); | 294 gfx::Point centroid(center, center); |
297 // For the left shelf alignment, we need to right-justify. For other shelf | 295 // For the left shelf alignment, we need to right-justify. For other shelf |
298 // alignments, left/top justification (i.e. no adjustments are necessary). | 296 // alignments, left/top justification (i.e. no adjustments are necessary). |
299 if (SHELF_ALIGNMENT_LEFT == wm_shelf_->GetAlignment()) | 297 if (SHELF_ALIGNMENT_LEFT == wm_shelf_->GetAlignment()) |
300 centroid.set_x(width() - center); | 298 centroid.set_x(width() - center); |
301 return centroid; | 299 return centroid; |
302 } | 300 } |
303 | 301 |
304 } // namespace ash | 302 } // namespace ash |
OLD | NEW |