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

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

Issue 1478303003: Converted all Views to use an InkDropDelegate instead of a InkDropAnimationController. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Collapsed 'if' conditionals in to a single 'if' in ToolbarButton::OnMousePressed(). Created 5 years 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 c4a1a82692536555953b1a460b97e6126edc9089..7f155266743c6341c0ead0332fc562ada217f616 100644
--- a/chrome/browser/ui/views/toolbar/app_menu_button.cc
+++ b/chrome/browser/ui/views/toolbar/app_menu_button.cc
@@ -24,8 +24,7 @@
#include "ui/gfx/paint_vector_icon.h"
#include "ui/gfx/vector_icons_public.h"
#include "ui/keyboard/keyboard_controller.h"
-#include "ui/views/animation/ink_drop_animation_controller.h"
-#include "ui/views/animation/ink_drop_animation_controller_factory.h"
+#include "ui/views/animation/button_ink_drop_delegate.h"
#include "ui/views/controls/button/label_button_border.h"
#include "ui/views/controls/menu/menu_listener.h"
#include "ui/views/metrics.h"
@@ -37,9 +36,6 @@ bool AppMenuButton::g_open_app_immediately_for_testing = false;
AppMenuButton::AppMenuButton(ToolbarView* toolbar_view)
: views::MenuButton(NULL, base::string16(), toolbar_view, false),
severity_(AppMenuIconPainter::SEVERITY_NONE),
- ink_drop_animation_controller_(
- views::InkDropAnimationControllerFactory::
- CreateInkDropAnimationController(this)),
toolbar_view_(toolbar_view),
allow_extension_dragging_(
extensions::FeatureSwitch::extension_action_redesign()
@@ -47,6 +43,9 @@ AppMenuButton::AppMenuButton(ToolbarView* toolbar_view)
destroyed_(nullptr),
margin_trailing_(0),
weak_factory_(this) {
+ scoped_ptr<views::InkDropDelegate> new_ink_drop_delegate(
+ new views::ButtonInkDropDelegate(this, this));
+ SetInkDropDelegate(new_ink_drop_delegate.Pass());
if (!ui::MaterialDesignController::IsModeMaterial())
icon_painter_.reset(new AppMenuIconPainter(this));
@@ -55,10 +54,8 @@ AppMenuButton::AppMenuButton(ToolbarView* toolbar_view)
const int kInkDropSmallSize = 24;
const int kInkDropSmallCornerRadius = 2;
- ink_drop_animation_controller_->SetInkDropSize(
- gfx::Size(kInkDropLargeSize, kInkDropLargeSize),
- kInkDropLargeCornerRadius,
- gfx::Size(kInkDropSmallSize, kInkDropSmallSize),
+ ink_drop_delegate()->SetInkDropSize(
+ kInkDropLargeSize, kInkDropLargeCornerRadius, kInkDropSmallSize,
kInkDropSmallCornerRadius);
}
@@ -108,13 +105,11 @@ void AppMenuButton::ShowMenu(bool for_drop) {
bool destroyed = false;
destroyed_ = &destroyed;
- ink_drop_animation_controller_->AnimateToState(
- views::InkDropState::ACTIVATED);
+ ink_drop_delegate()->OnAction(views::InkDropState::ACTIVATED);
menu_->RunMenu(this);
if (!destroyed) {
- ink_drop_animation_controller_->AnimateToState(
- views::InkDropState::DEACTIVATED);
+ ink_drop_delegate()->OnAction(views::InkDropState::DEACTIVATED);
destroyed_ = nullptr;
}
}
@@ -268,11 +263,6 @@ bool AppMenuButton::CanDrop(const ui::OSExchangeData& data) {
views::View::CanDrop(data);
}
-void AppMenuButton::Layout() {
- MenuButton::Layout();
- ink_drop_animation_controller_->SetInkDropCenter(CalculateInkDropCenter());
-}
-
void AppMenuButton::OnDragEntered(const ui::DropTargetEvent& event) {
DCHECK(allow_extension_dragging_);
DCHECK(!weak_factory_.HasWeakPtrs());

Powered by Google App Engine
This is Rietveld 408576698