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 "chrome/browser/ui/views/toolbar/toolbar_button.h" | 5 #include "chrome/browser/ui/views/toolbar/toolbar_button.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
219 ui::MenuSourceType source_type) { | 219 ui::MenuSourceType source_type) { |
220 if (!enabled()) | 220 if (!enabled()) |
221 return; | 221 return; |
222 | 222 |
223 show_menu_factory_.InvalidateWeakPtrs(); | 223 show_menu_factory_.InvalidateWeakPtrs(); |
224 ShowDropDownMenu(source_type); | 224 ShowDropDownMenu(source_type); |
225 } | 225 } |
226 | 226 |
227 void ToolbarButton::AddInkDropLayer(ui::Layer* ink_drop_layer) { | 227 void ToolbarButton::AddInkDropLayer(ui::Layer* ink_drop_layer) { |
228 SetPaintToLayer(true); | 228 SetPaintToLayer(true); |
229 SetFillsBoundsOpaquely(false); | |
229 image()->SetPaintToLayer(true); | 230 image()->SetPaintToLayer(true); |
230 image()->SetFillsBoundsOpaquely(false); | 231 image()->SetFillsBoundsOpaquely(false); |
231 | 232 |
232 layer()->Add(ink_drop_layer); | 233 layer()->Add(ink_drop_layer); |
233 layer()->StackAtBottom(ink_drop_layer); | 234 layer()->StackAtBottom(ink_drop_layer); |
235 | |
236 // Invalidates the contents of the parent's layer which may contain | |
237 // a stale close/reload icon that should not remain visible. | |
238 parent()->SchedulePaint(); | |
bruthig
2015/11/18 16:26:17
sadrul@, would it make sense to move this parent()
jonross
2015/11/18 16:36:52
I'm slightly surprised that changing the layer tre
bruthig
2015/11/18 16:51:19
I've posted my propsed changes here: https://coder
tdanderson
2015/11/19 15:15:42
Note I'm landing this CL as-is, feel free to modif
| |
234 } | 239 } |
235 | 240 |
236 void ToolbarButton::RemoveInkDropLayer(ui::Layer* ink_drop_layer) { | 241 void ToolbarButton::RemoveInkDropLayer(ui::Layer* ink_drop_layer) { |
237 layer()->Remove(ink_drop_layer); | 242 layer()->Remove(ink_drop_layer); |
238 | 243 |
239 image()->SetFillsBoundsOpaquely(true); | 244 image()->SetFillsBoundsOpaquely(true); |
240 image()->SetPaintToLayer(false); | 245 image()->SetPaintToLayer(false); |
241 SetPaintToLayer(false); | 246 SetPaintToLayer(false); |
242 } | 247 } |
243 | 248 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
342 SetState(STATE_NORMAL); | 347 SetState(STATE_NORMAL); |
343 } | 348 } |
344 | 349 |
345 gfx::Point ToolbarButton::CalculateInkDropCenter() const { | 350 gfx::Point ToolbarButton::CalculateInkDropCenter() const { |
346 return GetLocalBounds().CenterPoint(); | 351 return GetLocalBounds().CenterPoint(); |
347 } | 352 } |
348 | 353 |
349 const char* ToolbarButton::GetClassName() const { | 354 const char* ToolbarButton::GetClassName() const { |
350 return "ToolbarButton"; | 355 return "ToolbarButton"; |
351 } | 356 } |
OLD | NEW |