| 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" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 112 |
| 113 std::unique_ptr<views::InkDropMask> OverflowButton::CreateInkDropMask() const { | 113 std::unique_ptr<views::InkDropMask> OverflowButton::CreateInkDropMask() const { |
| 114 gfx::Insets insets = GetLocalBounds().InsetsFrom(CalculateButtonBounds()); | 114 gfx::Insets insets = GetLocalBounds().InsetsFrom(CalculateButtonBounds()); |
| 115 return base::MakeUnique<views::RoundRectInkDropMask>( | 115 return base::MakeUnique<views::RoundRectInkDropMask>( |
| 116 size(), insets, kOverflowButtonCornerRadius); | 116 size(), insets, kOverflowButtonCornerRadius); |
| 117 } | 117 } |
| 118 | 118 |
| 119 void OverflowButton::PaintBackground(gfx::Canvas* canvas, | 119 void OverflowButton::PaintBackground(gfx::Canvas* canvas, |
| 120 const gfx::Rect& bounds) { | 120 const gfx::Rect& bounds) { |
| 121 if (MaterialDesignController::IsShelfMaterial()) { | 121 if (MaterialDesignController::IsShelfMaterial()) { |
| 122 cc::PaintFlags background_paint; | 122 cc::PaintFlags flags; |
| 123 background_paint.setFlags(cc::PaintFlags::kAntiAlias_Flag); | 123 flags.setFlags(cc::PaintFlags::kAntiAlias_Flag); |
| 124 background_paint.setColor(SkColorSetA(kShelfBaseColor, background_alpha_)); | 124 flags.setColor(SkColorSetA(kShelfBaseColor, background_alpha_)); |
| 125 canvas->DrawRoundRect(bounds, kOverflowButtonCornerRadius, | 125 canvas->DrawRoundRect(bounds, kOverflowButtonCornerRadius, flags); |
| 126 background_paint); | |
| 127 } else { | 126 } else { |
| 128 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 127 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 129 const gfx::ImageSkia* background = | 128 const gfx::ImageSkia* background = |
| 130 rb.GetImageNamed(NonMaterialBackgroundImageId()).ToImageSkia(); | 129 rb.GetImageNamed(NonMaterialBackgroundImageId()).ToImageSkia(); |
| 131 canvas->DrawImageInt(*background, bounds.x(), bounds.y()); | 130 canvas->DrawImageInt(*background, bounds.x(), bounds.y()); |
| 132 } | 131 } |
| 133 } | 132 } |
| 134 | 133 |
| 135 void OverflowButton::PaintForeground(gfx::Canvas* canvas, | 134 void OverflowButton::PaintForeground(gfx::Canvas* canvas, |
| 136 const gfx::Rect& bounds) { | 135 const gfx::Rect& bounds) { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 bounds = | 196 bounds = |
| 198 gfx::Rect(bounds.x() + (bounds.width() - background->width()) / 2, | 197 gfx::Rect(bounds.x() + (bounds.width() - background->width()) / 2, |
| 199 bounds.y() + kShelfItemInset, background->width(), | 198 bounds.y() + kShelfItemInset, background->width(), |
| 200 background->height()); | 199 background->height()); |
| 201 } | 200 } |
| 202 } | 201 } |
| 203 return bounds; | 202 return bounds; |
| 204 } | 203 } |
| 205 | 204 |
| 206 } // namespace ash | 205 } // namespace ash |
| OLD | NEW |