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

Unified Diff: ui/views/animation/test/ink_drop_impl_test_api.cc

Issue 2447523002: [ash-md] Added different highlighting modes to the InkDropImpl. (Closed)
Patch Set: Fixed InkDropHostView::GetInkDrop() to use CreateInkDrop(). Created 4 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
« no previous file with comments | « ui/views/animation/test/ink_drop_impl_test_api.h ('k') | ui/views/animation/test/test_ink_drop_host.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/animation/test/ink_drop_impl_test_api.cc
diff --git a/ui/views/animation/test/ink_drop_impl_test_api.cc b/ui/views/animation/test/ink_drop_impl_test_api.cc
index d35363d5bd54c99172f8427a8b04a1a14fd1c23b..dac20c40be3147142b670ed98d23af242aee8a4d 100644
--- a/ui/views/animation/test/ink_drop_impl_test_api.cc
+++ b/ui/views/animation/test/ink_drop_impl_test_api.cc
@@ -4,8 +4,8 @@
#include "ui/views/animation/test/ink_drop_impl_test_api.h"
+#include "base/memory/ptr_util.h"
#include "ui/views/animation/ink_drop_highlight.h"
-#include "ui/views/animation/ink_drop_impl.h"
#include "ui/views/animation/ink_drop_ripple.h"
#include "ui/views/animation/test/ink_drop_highlight_test_api.h"
#include "ui/views/animation/test/ink_drop_ripple_test_api.h"
@@ -13,11 +13,95 @@
namespace views {
namespace test {
+//
+// AccessFactoryOnExitHighlightState
+//
+
+void InkDropImplTestApi::AccessFactoryOnExitHighlightState::Install(
+ InkDropImpl::HighlightStateFactory* state_factory) {
+ state_factory->ink_drop()->SetHighlightState(
+ base::MakeUnique<InkDropImplTestApi::AccessFactoryOnExitHighlightState>(
+ state_factory));
+}
+
+InkDropImplTestApi::AccessFactoryOnExitHighlightState::
+ AccessFactoryOnExitHighlightState(
+ InkDropImpl::HighlightStateFactory* state_factory)
+ : HighlightState(state_factory) {}
+
+void InkDropImplTestApi::AccessFactoryOnExitHighlightState::Exit() {
+ state_factory()->ink_drop()->SetHovered(false);
+}
+
+void InkDropImplTestApi::AccessFactoryOnExitHighlightState::
+ ShowOnHoverChanged() {}
+
+void InkDropImplTestApi::AccessFactoryOnExitHighlightState::OnHoverChanged() {}
+
+void InkDropImplTestApi::AccessFactoryOnExitHighlightState::
+ ShowOnFocusChanged() {}
+
+void InkDropImplTestApi::AccessFactoryOnExitHighlightState::OnFocusChanged() {}
+
+void InkDropImplTestApi::AccessFactoryOnExitHighlightState::AnimationStarted(
+ InkDropState ink_drop_state) {}
+
+void InkDropImplTestApi::AccessFactoryOnExitHighlightState::AnimationEnded(
+ InkDropState ink_drop_state,
+ InkDropAnimationEndedReason reason) {}
+
+//
+// AccessFactoryOnExitHighlightState
+//
+
+void InkDropImplTestApi::SetStateOnExitHighlightState::Install(
+ InkDropImpl::HighlightStateFactory* state_factory) {
+ state_factory->ink_drop()->SetHighlightState(
+ base::MakeUnique<InkDropImplTestApi::SetStateOnExitHighlightState>(
+ state_factory));
+}
+
+InkDropImplTestApi::SetStateOnExitHighlightState::SetStateOnExitHighlightState(
+ InkDropImpl::HighlightStateFactory* state_factory)
+ : HighlightState(state_factory) {}
+
+void InkDropImplTestApi::SetStateOnExitHighlightState::Exit() {
+ InkDropImplTestApi::AccessFactoryOnExitHighlightState::Install(
+ state_factory());
+}
+
+void InkDropImplTestApi::SetStateOnExitHighlightState::ShowOnHoverChanged() {}
+
+void InkDropImplTestApi::SetStateOnExitHighlightState::OnHoverChanged() {}
+
+void InkDropImplTestApi::SetStateOnExitHighlightState::ShowOnFocusChanged() {}
+
+void InkDropImplTestApi::SetStateOnExitHighlightState::OnFocusChanged() {}
+
+void InkDropImplTestApi::SetStateOnExitHighlightState::AnimationStarted(
+ InkDropState ink_drop_state) {}
+
+void InkDropImplTestApi::SetStateOnExitHighlightState::AnimationEnded(
+ InkDropState ink_drop_state,
+ InkDropAnimationEndedReason reason) {}
+
+//
+// InkDropImplTestApi
+//
+
InkDropImplTestApi::InkDropImplTestApi(InkDropImpl* ink_drop)
: ui::test::MultiLayerAnimatorTestController(this), ink_drop_(ink_drop) {}
InkDropImplTestApi::~InkDropImplTestApi() {}
+void InkDropImplTestApi::SetShouldHighlight(bool should_highlight) {
+ ink_drop_->SetShowHighlightOnHover(should_highlight);
+ ink_drop_->SetHovered(should_highlight);
+ ink_drop_->SetShowHighlightOnFocus(should_highlight);
+ ink_drop_->SetFocused(should_highlight);
+ DCHECK_EQ(should_highlight, ink_drop_->ShouldHighlight());
+}
+
const InkDropHighlight* InkDropImplTestApi::highlight() const {
return ink_drop_->highlight_.get();
}
@@ -26,6 +110,10 @@ bool InkDropImplTestApi::IsHighlightFadingInOrVisible() const {
return ink_drop_->IsHighlightFadingInOrVisible();
}
+bool InkDropImplTestApi::ShouldHighlight() const {
+ return ink_drop_->ShouldHighlight();
+}
+
std::vector<ui::LayerAnimator*> InkDropImplTestApi::GetLayerAnimators() {
std::vector<ui::LayerAnimator*> animators;
« no previous file with comments | « ui/views/animation/test/ink_drop_impl_test_api.h ('k') | ui/views/animation/test/test_ink_drop_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698