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

Side by Side Diff: ui/views/animation/ink_drop_host_view.cc

Issue 2033553003: Add MD ink drop ripple to shelf app items (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed TODO Created 4 years, 6 months 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "ui/views/animation/ink_drop_host_view.h" 5 #include "ui/views/animation/ink_drop_host_view.h"
6 6
7 #include "ui/events/event.h" 7 #include "ui/events/event.h"
8 #include "ui/events/scoped_target_handler.h" 8 #include "ui/events/scoped_target_handler.h"
9 #include "ui/gfx/color_palette.h" 9 #include "ui/gfx/color_palette.h"
10 #include "ui/gfx/geometry/size_conversions.h" 10 #include "ui/gfx/geometry/size_conversions.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 94
95 // An instance of ScopedTargetHandler allowing |this| to handle events. 95 // An instance of ScopedTargetHandler allowing |this| to handle events.
96 ui::ScopedTargetHandler target_handler_; 96 ui::ScopedTargetHandler target_handler_;
97 97
98 DISALLOW_COPY_AND_ASSIGN(InkDropGestureHandler); 98 DISALLOW_COPY_AND_ASSIGN(InkDropGestureHandler);
99 }; 99 };
100 100
101 InkDropHostView::InkDropHostView() 101 InkDropHostView::InkDropHostView()
102 : ink_drop_(new InkDropStub()), 102 : ink_drop_(new InkDropStub()),
103 ink_drop_size_(kInkDropSize, kInkDropSize), 103 ink_drop_size_(kInkDropSize, kInkDropSize),
104 old_paint_to_layer_(false),
104 destroying_(false) {} 105 destroying_(false) {}
105 106
106 InkDropHostView::~InkDropHostView() { 107 InkDropHostView::~InkDropHostView() {
107 // TODO(bruthig): Improve InkDropImpl to be safer about calling back to 108 // TODO(bruthig): Improve InkDropImpl to be safer about calling back to
108 // potentially destroyed InkDropHosts and remove |destroying_|. 109 // potentially destroyed InkDropHosts and remove |destroying_|.
109 destroying_ = true; 110 destroying_ = true;
110 } 111 }
111 112
112 void InkDropHostView::AddInkDropLayer(ui::Layer* ink_drop_layer) { 113 void InkDropHostView::AddInkDropLayer(ui::Layer* ink_drop_layer) {
114 old_paint_to_layer_ = layer() != nullptr;
113 SetPaintToLayer(true); 115 SetPaintToLayer(true);
114 layer()->SetFillsBoundsOpaquely(false); 116 layer()->SetFillsBoundsOpaquely(false);
115 layer()->Add(ink_drop_layer); 117 layer()->Add(ink_drop_layer);
116 layer()->StackAtBottom(ink_drop_layer); 118 layer()->StackAtBottom(ink_drop_layer);
117 } 119 }
118 120
119 void InkDropHostView::RemoveInkDropLayer(ui::Layer* ink_drop_layer) { 121 void InkDropHostView::RemoveInkDropLayer(ui::Layer* ink_drop_layer) {
120 // No need to do anything when called during shutdown, and if a derived 122 // No need to do anything when called during shutdown, and if a derived
121 // class has overridden Add/RemoveInkDropLayer, running this implementation 123 // class has overridden Add/RemoveInkDropLayer, running this implementation
122 // would be wrong. 124 // would be wrong.
123 if (destroying_) 125 if (destroying_)
124 return; 126 return;
125 layer()->Remove(ink_drop_layer); 127 layer()->Remove(ink_drop_layer);
126 SetPaintToLayer(false); 128 SetPaintToLayer(old_paint_to_layer_);
127 } 129 }
128 130
129 std::unique_ptr<InkDropRipple> InkDropHostView::CreateInkDropRipple() const { 131 std::unique_ptr<InkDropRipple> InkDropHostView::CreateInkDropRipple() const {
130 std::unique_ptr<InkDropRipple> ripple(new SquareInkDropRipple( 132 std::unique_ptr<InkDropRipple> ripple(new SquareInkDropRipple(
131 CalculateLargeInkDropSize(ink_drop_size_), kInkDropLargeCornerRadius, 133 CalculateLargeInkDropSize(ink_drop_size_), kInkDropLargeCornerRadius,
132 ink_drop_size_, kInkDropSmallCornerRadius, GetInkDropCenter(), 134 ink_drop_size_, kInkDropSmallCornerRadius, GetInkDropCenter(),
133 GetInkDropBaseColor())); 135 GetInkDropBaseColor()));
134 return ripple; 136 return ripple;
135 } 137 }
136 138
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 gesture_handler_.reset(); 200 gesture_handler_.reset();
199 ink_drop_.reset(new InkDropStub()); 201 ink_drop_.reset(new InkDropStub());
200 } 202 }
201 } 203 }
202 204
203 void InkDropHostView::AnimateInkDrop(InkDropState ink_drop_state) { 205 void InkDropHostView::AnimateInkDrop(InkDropState ink_drop_state) {
204 ink_drop_->AnimateToState(ink_drop_state); 206 ink_drop_->AnimateToState(ink_drop_state);
205 } 207 }
206 208
207 } // namespace views 209 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/animation/ink_drop_host_view.h ('k') | ui/views/animation/test/ink_drop_host_view_test_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698