Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(374)

Side by Side Diff: ash/common/shelf/overflow_button.cc

Issue 2447523002: [ash-md] Added different highlighting modes to the InkDropImpl. (Closed)
Patch Set: Fixed InkDropHostView::GetInkDrop() to use CreateInkDrop(). Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/common/shelf/overflow_button.h ('k') | ash/common/shelf/shelf_button.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/memory/ptr_util.h" 14 #include "base/memory/ptr_util.h"
15 #include "grit/ash_resources.h" 15 #include "grit/ash_resources.h"
16 #include "grit/ash_strings.h" 16 #include "grit/ash_strings.h"
17 #include "third_party/skia/include/core/SkPaint.h" 17 #include "third_party/skia/include/core/SkPaint.h"
18 #include "third_party/skia/include/core/SkPath.h" 18 #include "third_party/skia/include/core/SkPath.h"
19 #include "ui/base/l10n/l10n_util.h" 19 #include "ui/base/l10n/l10n_util.h"
20 #include "ui/base/resource/resource_bundle.h" 20 #include "ui/base/resource/resource_bundle.h"
21 #include "ui/gfx/canvas.h" 21 #include "ui/gfx/canvas.h"
22 #include "ui/gfx/image/image_skia_operations.h" 22 #include "ui/gfx/image/image_skia_operations.h"
23 #include "ui/gfx/paint_vector_icon.h" 23 #include "ui/gfx/paint_vector_icon.h"
24 #include "ui/gfx/skbitmap_operations.h" 24 #include "ui/gfx/skbitmap_operations.h"
25 #include "ui/gfx/skia_util.h" 25 #include "ui/gfx/skia_util.h"
26 #include "ui/gfx/transform.h" 26 #include "ui/gfx/transform.h"
27 #include "ui/gfx/vector_icons_public.h" 27 #include "ui/gfx/vector_icons_public.h"
28 #include "ui/views/animation/flood_fill_ink_drop_ripple.h" 28 #include "ui/views/animation/flood_fill_ink_drop_ripple.h"
29 #include "ui/views/animation/ink_drop_impl.h"
29 30
30 namespace ash { 31 namespace ash {
31 32
32 OverflowButton::OverflowButton(ShelfView* shelf_view, WmShelf* wm_shelf) 33 OverflowButton::OverflowButton(ShelfView* shelf_view, WmShelf* wm_shelf)
33 : CustomButton(nullptr), 34 : CustomButton(nullptr),
34 bottom_image_(nullptr), 35 bottom_image_(nullptr),
35 shelf_view_(shelf_view), 36 shelf_view_(shelf_view),
36 wm_shelf_(wm_shelf), 37 wm_shelf_(wm_shelf),
37 background_alpha_(0) { 38 background_alpha_(0) {
38 DCHECK(shelf_view_); 39 DCHECK(shelf_view_);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 background_alpha_ = alpha; 76 background_alpha_ = alpha;
76 SchedulePaint(); 77 SchedulePaint();
77 } 78 }
78 79
79 void OverflowButton::OnPaint(gfx::Canvas* canvas) { 80 void OverflowButton::OnPaint(gfx::Canvas* canvas) {
80 gfx::Rect bounds = CalculateButtonBounds(); 81 gfx::Rect bounds = CalculateButtonBounds();
81 PaintBackground(canvas, bounds); 82 PaintBackground(canvas, bounds);
82 PaintForeground(canvas, bounds); 83 PaintForeground(canvas, bounds);
83 } 84 }
84 85
86 std::unique_ptr<views::InkDrop> OverflowButton::CreateInkDrop() {
87 return CreateDefaultFloodFillInkDropImpl();
88 }
89
85 std::unique_ptr<views::InkDropRipple> OverflowButton::CreateInkDropRipple() 90 std::unique_ptr<views::InkDropRipple> OverflowButton::CreateInkDropRipple()
86 const { 91 const {
87 return base::MakeUnique<views::FloodFillInkDropRipple>( 92 return base::MakeUnique<views::FloodFillInkDropRipple>(
88 CalculateButtonBounds(), GetInkDropCenterBasedOnLastEvent(), 93 CalculateButtonBounds(), GetInkDropCenterBasedOnLastEvent(),
89 GetInkDropBaseColor(), ink_drop_visible_opacity()); 94 GetInkDropBaseColor(), ink_drop_visible_opacity());
90 } 95 }
91 96
92 bool OverflowButton::ShouldEnterPushedState(const ui::Event& event) { 97 bool OverflowButton::ShouldEnterPushedState(const ui::Event& event) {
93 if (shelf_view_->IsShowingOverflowBubble()) 98 if (shelf_view_->IsShowingOverflowBubble())
94 return false; 99 return false;
95 100
96 return CustomButton::ShouldEnterPushedState(event); 101 return CustomButton::ShouldEnterPushedState(event);
97 } 102 }
98 103
99 bool OverflowButton::ShouldShowInkDropHighlight() const {
100 return false;
101 }
102
103 void OverflowButton::NotifyClick(const ui::Event& event) { 104 void OverflowButton::NotifyClick(const ui::Event& event) {
104 CustomButton::NotifyClick(event); 105 CustomButton::NotifyClick(event);
105 shelf_view_->ButtonPressed(this, event, GetInkDrop()); 106 shelf_view_->ButtonPressed(this, event, GetInkDrop());
106 } 107 }
107 108
108 void OverflowButton::PaintBackground(gfx::Canvas* canvas, 109 void OverflowButton::PaintBackground(gfx::Canvas* canvas,
109 const gfx::Rect& bounds) { 110 const gfx::Rect& bounds) {
110 if (MaterialDesignController::IsShelfMaterial()) { 111 if (MaterialDesignController::IsShelfMaterial()) {
111 SkPaint background_paint; 112 SkPaint background_paint;
112 background_paint.setFlags(SkPaint::kAntiAlias_Flag); 113 background_paint.setFlags(SkPaint::kAntiAlias_Flag);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 bounds = 190 bounds =
190 gfx::Rect(bounds.x() + (bounds.width() - background->width()) / 2, 191 gfx::Rect(bounds.x() + (bounds.width() - background->width()) / 2,
191 bounds.y() + kShelfItemInset, background->width(), 192 bounds.y() + kShelfItemInset, background->width(),
192 background->height()); 193 background->height());
193 } 194 }
194 } 195 }
195 return bounds; 196 return bounds;
196 } 197 }
197 198
198 } // namespace ash 199 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/shelf/overflow_button.h ('k') | ash/common/shelf/shelf_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698