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

Unified Diff: chrome/browser/ui/views/toolbar/app_menu_button.cc

Issue 1411833006: Refactoring to make adding ink drop animations easier (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Attempt to refactor ink drop animations (moving more stuff into InkDropDelegate) Created 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/toolbar/app_menu_button.cc
diff --git a/chrome/browser/ui/views/toolbar/app_menu_button.cc b/chrome/browser/ui/views/toolbar/app_menu_button.cc
index fe81877bfa59310f01102317d29f51d45b635fbd..62bb1b8a1d2bc879e805869daa50926524756121 100644
--- a/chrome/browser/ui/views/toolbar/app_menu_button.cc
+++ b/chrome/browser/ui/views/toolbar/app_menu_button.cc
@@ -198,6 +198,13 @@ void AppMenuButton::RemoveInkDropLayer(ui::Layer* ink_drop_layer) {
SetPaintToLayer(false);
}
+gfx::Point AppMenuButton::CalculateInkDropCenter() const {
+ // ToolbarView extends the bounds of the app button to the right in maximized
+ // mode. So instead of using the center point of local bounds, we use the
+ // center point of preferred size which doesn't change in maximized mode.
+ return gfx::Rect(GetPreferredSize()).CenterPoint();
+}
+
const char* AppMenuButton::GetClassName() const {
return "AppMenuButton";
}
@@ -225,12 +232,7 @@ bool AppMenuButton::CanDrop(const ui::OSExchangeData& data) {
void AppMenuButton::Layout() {
MenuButton::Layout();
-
- // ToolbarView extends the bounds of the app button to the right in maximized
- // mode. So instead of using the center point of local bounds, we use the
- // center point of preferred size which doesn't change in maximized mode.
- ink_drop_animation_controller_->SetInkDropCenter(
- gfx::Rect(GetPreferredSize()).CenterPoint());
+ ink_drop_animation_controller_->SetInkDropCenter(CalculateInkDropCenter());
}
void AppMenuButton::OnDragEntered(const ui::DropTargetEvent& event) {

Powered by Google App Engine
This is Rietveld 408576698