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

Side by Side Diff: chrome/browser/ui/views/toolbar/toolbar_button.h

Issue 1390113006: Added material design mouse hover feedback support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed the *InkDropControllerFactory* tests to work with the hover timer. 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_BUTTON_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_BUTTON_H_
6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_BUTTON_H_ 6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_BUTTON_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "ui/gfx/geometry/point.h" 9 #include "ui/gfx/geometry/point.h"
10 #include "ui/views/animation/ink_drop_host.h" 10 #include "ui/views/animation/ink_drop_host.h"
(...skipping 30 matching lines...) Expand all
41 bool IsMenuShowing() const; 41 bool IsMenuShowing() const;
42 42
43 // views::LabelButton: 43 // views::LabelButton:
44 gfx::Size GetPreferredSize() const override; 44 gfx::Size GetPreferredSize() const override;
45 void Layout() override; 45 void Layout() override;
46 bool OnMousePressed(const ui::MouseEvent& event) override; 46 bool OnMousePressed(const ui::MouseEvent& event) override;
47 bool OnMouseDragged(const ui::MouseEvent& event) override; 47 bool OnMouseDragged(const ui::MouseEvent& event) override;
48 void OnMouseReleased(const ui::MouseEvent& event) override; 48 void OnMouseReleased(const ui::MouseEvent& event) override;
49 // Showing the drop down results in a MouseCaptureLost, we need to ignore it. 49 // Showing the drop down results in a MouseCaptureLost, we need to ignore it.
50 void OnMouseCaptureLost() override; 50 void OnMouseCaptureLost() override;
51 void OnMouseEntered(const ui::MouseEvent& event) override;
51 void OnMouseExited(const ui::MouseEvent& event) override; 52 void OnMouseExited(const ui::MouseEvent& event) override;
52 void OnGestureEvent(ui::GestureEvent* event) override; 53 void OnGestureEvent(ui::GestureEvent* event) override;
53 void GetAccessibleState(ui::AXViewState* state) override; 54 void GetAccessibleState(ui::AXViewState* state) override;
54 scoped_ptr<views::LabelButtonBorder> CreateDefaultBorder() const override; 55 scoped_ptr<views::LabelButtonBorder> CreateDefaultBorder() const override;
56 void OnEnabledChanged() override;
55 57
56 // views::ContextMenuController: 58 // views::ContextMenuController:
57 void ShowContextMenuForView(View* source, 59 void ShowContextMenuForView(View* source,
58 const gfx::Point& point, 60 const gfx::Point& point,
59 ui::MenuSourceType source_type) override; 61 ui::MenuSourceType source_type) override;
60 62
61 // views::InkDropHost: 63 // views::InkDropHost:
62 void AddInkDropLayer(ui::Layer* ink_drop_layer) override; 64 void AddInkDropLayer(ui::Layer* ink_drop_layer) override;
63 void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override; 65 void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override;
64 66
65 protected: 67 protected:
66 // views::LabelButton: 68 // views::LabelButton:
67 bool ShouldEnterPushedState(const ui::Event& event) override; 69 bool ShouldEnterPushedState(const ui::Event& event) override;
68 void NotifyClick(const ui::Event& event) override; 70 void NotifyClick(const ui::Event& event) override;
69 71
70 // Returns if menu should be shown. Override this to change default behavior. 72 // Returns if menu should be shown. Override this to change default behavior.
71 virtual bool ShouldShowMenu(); 73 virtual bool ShouldShowMenu();
72 74
73 // Function to show the dropdown menu. 75 // Function to show the dropdown menu.
74 virtual void ShowDropDownMenu(ui::MenuSourceType source_type); 76 virtual void ShowDropDownMenu(ui::MenuSourceType source_type);
75 77
76 // Returns the Point where the ink drop should be centered. 78 // Returns the Point where the ink drop should be centered.
77 virtual gfx::Point CalculateInkDropCenter() const; 79 virtual gfx::Point CalculateInkDropCenter() const;
78 80
79 views::InkDropAnimationController* ink_drop_animation_controller() { 81 views::InkDropAnimationController* ink_drop_animation_controller() {
80 return ink_drop_animation_controller_.get(); 82 return ink_drop_animation_controller_.get();
81 } 83 }
82 84
83 private: 85 private:
86 // Updates the |ink_drop_animation_controller_|'s hover state.
87 void UpdateInkDropHoverState();
88
84 // views::LabelButton: 89 // views::LabelButton:
85 const char* GetClassName() const override; 90 const char* GetClassName() const override;
86 91
87 // The model that populates the attached menu. 92 // The model that populates the attached menu.
88 scoped_ptr<ui::MenuModel> model_; 93 scoped_ptr<ui::MenuModel> model_;
89 94
90 // Indicates if menu is currently showing. 95 // Indicates if menu is currently showing.
91 bool menu_showing_; 96 bool menu_showing_;
92 97
93 // Y position of mouse when left mouse button is pressed 98 // Y position of mouse when left mouse button is pressed
94 int y_position_on_lbuttondown_; 99 int y_position_on_lbuttondown_;
95 100
96 // Menu runner to display drop down menu. 101 // Menu runner to display drop down menu.
97 scoped_ptr<views::MenuRunner> menu_runner_; 102 scoped_ptr<views::MenuRunner> menu_runner_;
98 103
99 // Animation controller for the ink drop ripple effect. 104 // Animation controller for the mouse hover and ink drop ripple effect.
100 scoped_ptr<views::InkDropAnimationController> ink_drop_animation_controller_; 105 scoped_ptr<views::InkDropAnimationController> ink_drop_animation_controller_;
101 106
102 // A factory for tasks that show the dropdown context menu for the button. 107 // A factory for tasks that show the dropdown context menu for the button.
103 base::WeakPtrFactory<ToolbarButton> show_menu_factory_; 108 base::WeakPtrFactory<ToolbarButton> show_menu_factory_;
104 109
105 DISALLOW_COPY_AND_ASSIGN(ToolbarButton); 110 DISALLOW_COPY_AND_ASSIGN(ToolbarButton);
106 }; 111 };
107 112
108 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_BUTTON_H_ 113 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_BUTTON_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698