| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/overflow_button.h" | 5 #include "ash/common/shelf/overflow_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_view.h" | 11 #include "ash/common/shelf/shelf_view.h" |
| 12 #include "ash/common/shelf/wm_shelf.h" | 12 #include "ash/common/shelf/wm_shelf.h" |
| 13 #include "ash/common/shelf/wm_shelf_util.h" | 13 #include "ash/common/shelf/wm_shelf_util.h" |
| 14 #include "ash/resources/vector_icons/vector_icons.h" | 14 #include "ash/resources/vector_icons/vector_icons.h" |
| 15 #include "base/memory/ptr_util.h" | 15 #include "base/memory/ptr_util.h" |
| 16 #include "grit/ash_resources.h" | 16 #include "grit/ash_resources.h" |
| 17 #include "grit/ash_strings.h" | 17 #include "grit/ash_strings.h" |
| 18 #include "third_party/skia/include/core/SkPaint.h" | |
| 19 #include "third_party/skia/include/core/SkPath.h" | 18 #include "third_party/skia/include/core/SkPath.h" |
| 20 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
| 21 #include "ui/base/resource/resource_bundle.h" | 20 #include "ui/base/resource/resource_bundle.h" |
| 22 #include "ui/gfx/canvas.h" | 21 #include "ui/gfx/canvas.h" |
| 23 #include "ui/gfx/image/image_skia_operations.h" | 22 #include "ui/gfx/image/image_skia_operations.h" |
| 24 #include "ui/gfx/paint_vector_icon.h" | 23 #include "ui/gfx/paint_vector_icon.h" |
| 25 #include "ui/gfx/skbitmap_operations.h" | 24 #include "ui/gfx/skbitmap_operations.h" |
| 26 #include "ui/gfx/skia_util.h" | 25 #include "ui/gfx/skia_util.h" |
| 27 #include "ui/gfx/transform.h" | 26 #include "ui/gfx/transform.h" |
| 28 #include "ui/views/animation/flood_fill_ink_drop_ripple.h" | 27 #include "ui/views/animation/flood_fill_ink_drop_ripple.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 | 112 |
| 114 std::unique_ptr<views::InkDropMask> OverflowButton::CreateInkDropMask() const { | 113 std::unique_ptr<views::InkDropMask> OverflowButton::CreateInkDropMask() const { |
| 115 gfx::Insets insets = GetLocalBounds().InsetsFrom(CalculateButtonBounds()); | 114 gfx::Insets insets = GetLocalBounds().InsetsFrom(CalculateButtonBounds()); |
| 116 return base::MakeUnique<views::RoundRectInkDropMask>( | 115 return base::MakeUnique<views::RoundRectInkDropMask>( |
| 117 size(), insets, kOverflowButtonCornerRadius); | 116 size(), insets, kOverflowButtonCornerRadius); |
| 118 } | 117 } |
| 119 | 118 |
| 120 void OverflowButton::PaintBackground(gfx::Canvas* canvas, | 119 void OverflowButton::PaintBackground(gfx::Canvas* canvas, |
| 121 const gfx::Rect& bounds) { | 120 const gfx::Rect& bounds) { |
| 122 if (MaterialDesignController::IsShelfMaterial()) { | 121 if (MaterialDesignController::IsShelfMaterial()) { |
| 123 SkPaint background_paint; | 122 cc::PaintFlags background_paint; |
| 124 background_paint.setFlags(SkPaint::kAntiAlias_Flag); | 123 background_paint.setFlags(cc::PaintFlags::kAntiAlias_Flag); |
| 125 background_paint.setColor(SkColorSetA(kShelfBaseColor, background_alpha_)); | 124 background_paint.setColor(SkColorSetA(kShelfBaseColor, background_alpha_)); |
| 126 canvas->DrawRoundRect(bounds, kOverflowButtonCornerRadius, | 125 canvas->DrawRoundRect(bounds, kOverflowButtonCornerRadius, |
| 127 background_paint); | 126 background_paint); |
| 128 } else { | 127 } else { |
| 129 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 128 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 130 const gfx::ImageSkia* background = | 129 const gfx::ImageSkia* background = |
| 131 rb.GetImageNamed(NonMaterialBackgroundImageId()).ToImageSkia(); | 130 rb.GetImageNamed(NonMaterialBackgroundImageId()).ToImageSkia(); |
| 132 canvas->DrawImageInt(*background, bounds.x(), bounds.y()); | 131 canvas->DrawImageInt(*background, bounds.x(), bounds.y()); |
| 133 } | 132 } |
| 134 } | 133 } |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 bounds = | 197 bounds = |
| 199 gfx::Rect(bounds.x() + (bounds.width() - background->width()) / 2, | 198 gfx::Rect(bounds.x() + (bounds.width() - background->width()) / 2, |
| 200 bounds.y() + kShelfItemInset, background->width(), | 199 bounds.y() + kShelfItemInset, background->width(), |
| 201 background->height()); | 200 background->height()); |
| 202 } | 201 } |
| 203 } | 202 } |
| 204 return bounds; | 203 return bounds; |
| 205 } | 204 } |
| 206 | 205 |
| 207 } // namespace ash | 206 } // namespace ash |
| OLD | NEW |