| 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" |
| 11 #include "ash/common/shelf/shelf_item_types.h" | 11 #include "ash/common/shelf/shelf_item_types.h" |
| 12 #include "ash/common/shelf/shelf_types.h" | 12 #include "ash/common/shelf/shelf_types.h" |
| 13 #include "ash/common/shelf/shelf_view.h" | 13 #include "ash/common/shelf/shelf_view.h" |
| 14 #include "ash/common/shelf/wm_shelf.h" | 14 #include "ash/common/shelf/wm_shelf.h" |
| 15 #include "ash/common/shelf/wm_shelf_util.h" | 15 #include "ash/common/shelf/wm_shelf_util.h" |
| 16 #include "ash/common/wm_shell.h" | 16 #include "ash/common/wm_shell.h" |
| 17 #include "ash/resources/vector_icons/vector_icons.h" |
| 17 #include "base/command_line.h" | 18 #include "base/command_line.h" |
| 18 #include "grit/ash_resources.h" | 19 #include "grit/ash_resources.h" |
| 19 #include "grit/ash_strings.h" | 20 #include "grit/ash_strings.h" |
| 20 #include "ui/accessibility/ax_view_state.h" | 21 #include "ui/accessibility/ax_view_state.h" |
| 21 #include "ui/app_list/app_list_switches.h" | 22 #include "ui/app_list/app_list_switches.h" |
| 22 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
| 23 #include "ui/base/resource/resource_bundle.h" | 24 #include "ui/base/resource/resource_bundle.h" |
| 24 #include "ui/gfx/canvas.h" | 25 #include "ui/gfx/canvas.h" |
| 25 #include "ui/gfx/paint_vector_icon.h" | 26 #include "ui/gfx/paint_vector_icon.h" |
| 26 #include "ui/gfx/vector_icons_public.h" | |
| 27 #include "ui/views/animation/square_ink_drop_ripple.h" | 27 #include "ui/views/animation/square_ink_drop_ripple.h" |
| 28 #include "ui/views/painter.h" | 28 #include "ui/views/painter.h" |
| 29 | 29 |
| 30 namespace ash { | 30 namespace ash { |
| 31 | 31 |
| 32 AppListButton::AppListButton(InkDropButtonListener* listener, | 32 AppListButton::AppListButton(InkDropButtonListener* listener, |
| 33 ShelfView* shelf_view, | 33 ShelfView* shelf_view, |
| 34 WmShelf* wm_shelf) | 34 WmShelf* wm_shelf) |
| 35 : views::ImageButton(nullptr), | 35 : views::ImageButton(nullptr), |
| 36 draw_background_as_active_(false), | 36 draw_background_as_active_(false), |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 } | 139 } |
| 140 } | 140 } |
| 141 | 141 |
| 142 void AppListButton::OnPaint(gfx::Canvas* canvas) { | 142 void AppListButton::OnPaint(gfx::Canvas* canvas) { |
| 143 // Call the base class first to paint any background/borders. | 143 // Call the base class first to paint any background/borders. |
| 144 View::OnPaint(canvas); | 144 View::OnPaint(canvas); |
| 145 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 145 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 146 | 146 |
| 147 const gfx::ImageSkia& foreground_image = | 147 const gfx::ImageSkia& foreground_image = |
| 148 MaterialDesignController::IsShelfMaterial() | 148 MaterialDesignController::IsShelfMaterial() |
| 149 ? CreateVectorIcon(gfx::VectorIconId::SHELF_APPLIST, kShelfIconColor) | 149 ? CreateVectorIcon(kShelfAppListIcon, kShelfIconColor) |
| 150 : *rb.GetImageNamed(IDR_ASH_SHELF_ICON_APPLIST).ToImageSkia(); | 150 : *rb.GetImageNamed(IDR_ASH_SHELF_ICON_APPLIST).ToImageSkia(); |
| 151 | 151 |
| 152 if (ash::MaterialDesignController::IsShelfMaterial()) { | 152 if (ash::MaterialDesignController::IsShelfMaterial()) { |
| 153 PaintBackgroundMD(canvas); | 153 PaintBackgroundMD(canvas); |
| 154 PaintForegroundMD(canvas, foreground_image); | 154 PaintForegroundMD(canvas, foreground_image); |
| 155 } else { | 155 } else { |
| 156 PaintAppListButton(canvas, foreground_image); | 156 PaintAppListButton(canvas, foreground_image); |
| 157 } | 157 } |
| 158 | 158 |
| 159 views::Painter::PaintFocusPainter(this, canvas, focus_painter()); | 159 views::Painter::PaintFocusPainter(this, canvas, focus_painter()); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 } | 282 } |
| 283 | 283 |
| 284 void AppListButton::SetDrawBackgroundAsActive(bool draw_background_as_active) { | 284 void AppListButton::SetDrawBackgroundAsActive(bool draw_background_as_active) { |
| 285 if (draw_background_as_active_ == draw_background_as_active) | 285 if (draw_background_as_active_ == draw_background_as_active) |
| 286 return; | 286 return; |
| 287 draw_background_as_active_ = draw_background_as_active; | 287 draw_background_as_active_ = draw_background_as_active; |
| 288 SchedulePaint(); | 288 SchedulePaint(); |
| 289 } | 289 } |
| 290 | 290 |
| 291 } // namespace ash | 291 } // namespace ash |
| OLD | NEW |