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

Side by Side Diff: ui/views/animation/ink_drop_factory.cc

Issue 2001843002: Use ink drop hover for focus states on toolbar buttons and location (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: layout Created 4 years, 6 months 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 unified diff | Download patch
« no previous file with comments | « ui/views/animation/ink_drop_delegate.h ('k') | ui/views/animation/ink_drop_host_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "ui/views/animation/ink_drop_factory.h" 5 #include "ui/views/animation/ink_drop_factory.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "ui/base/material_design/material_design_controller.h" 9 #include "ui/base/material_design/material_design_controller.h"
10 #include "ui/gfx/geometry/rect.h" 10 #include "ui/gfx/geometry/rect.h"
11 #include "ui/gfx/geometry/size.h" 11 #include "ui/gfx/geometry/size.h"
12 #include "ui/views/animation/ink_drop.h" 12 #include "ui/views/animation/ink_drop.h"
13 #include "ui/views/animation/ink_drop_impl.h" 13 #include "ui/views/animation/ink_drop_impl.h"
14 #include "ui/views/views_export.h" 14 #include "ui/views/views_export.h"
15 15
16 namespace views { 16 namespace views {
17 17
18 namespace { 18 namespace {
19 19
20 // A stub implementation of an InkDrop that can be used when material design is 20 // A stub implementation of an InkDrop that can be used when material design is
21 // not enabled. 21 // not enabled.
22 class InkDropStub : public InkDrop { 22 class InkDropStub : public InkDrop {
23 public: 23 public:
24 explicit InkDropStub(); 24 InkDropStub() {}
25 ~InkDropStub() override; 25 ~InkDropStub() override {}
26 26
27 // InkDrop: 27 // InkDrop:
28 InkDropState GetTargetInkDropState() const override; 28 InkDropState GetTargetInkDropState() const override {
29 bool IsVisible() const override; 29 return InkDropState::HIDDEN;
30 void AnimateToState(InkDropState state) override; 30 }
31 void SnapToActivated() override; 31 bool IsVisible() const override { return false; }
32 void SetHovered(bool is_hovered) override; 32 void AnimateToState(InkDropState state) override {}
33 void SnapToActivated() override {}
34 void SetHovered(bool is_hovered) override {}
35 void SetFocused(bool is_hovered) override {}
33 36
34 private: 37 private:
35 DISALLOW_COPY_AND_ASSIGN(InkDropStub); 38 DISALLOW_COPY_AND_ASSIGN(InkDropStub);
36 }; 39 };
37 40
38 InkDropStub::InkDropStub() {}
39
40 InkDropStub::~InkDropStub() {}
41
42 InkDropState InkDropStub::GetTargetInkDropState() const {
43 return InkDropState::HIDDEN;
44 }
45
46 bool InkDropStub::IsVisible() const {
47 return false;
48 }
49
50 void InkDropStub::AnimateToState(InkDropState state) {}
51
52 void InkDropStub::SnapToActivated() {}
53
54 void InkDropStub::SetHovered(bool is_hovered) {}
55
56 } // namespace 41 } // namespace
57 42
58 InkDropFactory::InkDropFactory() {} 43 InkDropFactory::InkDropFactory() {}
59 44
60 InkDropFactory::~InkDropFactory() {} 45 InkDropFactory::~InkDropFactory() {}
61 46
62 std::unique_ptr<InkDrop> InkDropFactory::CreateInkDrop( 47 std::unique_ptr<InkDrop> InkDropFactory::CreateInkDrop(
63 InkDropHost* ink_drop_host) { 48 InkDropHost* ink_drop_host) {
64 if (ui::MaterialDesignController::IsModeMaterial()) { 49 if (ui::MaterialDesignController::IsModeMaterial()) {
65 return base::WrapUnique(new InkDropImpl(ink_drop_host)); 50 return base::WrapUnique(new InkDropImpl(ink_drop_host));
66 } 51 }
67 52
68 return base::WrapUnique(new InkDropStub()); 53 return base::WrapUnique(new InkDropStub());
69 } 54 }
70 55
71 } // namespace views 56 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/animation/ink_drop_delegate.h ('k') | ui/views/animation/ink_drop_host_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698