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

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: Removed CustomButton::set_ink_drop_action_on_click() method. 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 eb9589d697838194d2bd737860902144d8e0e772..e2839f55bd88025b9b5ed803d56519ab4897bc05 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,16 +36,15 @@ 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()
->IsEnabled()),
destroyed_(nullptr),
margin_trailing_(0),
+ ink_drop_delegate_(new views::ButtonInkDropDelegate(this, this)),
weak_factory_(this) {
+ set_ink_drop_delegate(ink_drop_delegate_.get());
if (!ui::MaterialDesignController::IsModeMaterial())
icon_painter_.reset(new AppMenuIconPainter(this));
@@ -54,11 +52,8 @@ AppMenuButton::AppMenuButton(ToolbarView* toolbar_view)
const int kInkDropLargeCornerRadius = 5;
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 +103,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 +261,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());
« no previous file with comments | « chrome/browser/ui/views/toolbar/app_menu_button.h ('k') | chrome/browser/ui/views/toolbar/toolbar_action_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698