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

Side by Side Diff: ash/shelf/shelf_button.h

Issue 2033553003: Add MD ink drop ripple to shelf app items (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added tests 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
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 ASH_SHELF_SHELF_BUTTON_H_ 5 #ifndef ASH_SHELF_SHELF_BUTTON_H_
6 #define ASH_SHELF_SHELF_BUTTON_H_ 6 #define ASH_SHELF_SHELF_BUTTON_H_
7 7
8 #include "ash/ash_export.h" 8 #include "ash/ash_export.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "ui/gfx/shadow_value.h" 10 #include "ui/gfx/shadow_value.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 const gfx::ImageSkia& GetImage() const; 47 const gfx::ImageSkia& GetImage() const;
48 48
49 // |state| is or'd into the current state. 49 // |state| is or'd into the current state.
50 void AddState(State state); 50 void AddState(State state);
51 void ClearState(State state); 51 void ClearState(State state);
52 int state() const { return state_; } 52 int state() const { return state_; }
53 53
54 // Returns the bounds of the icon. 54 // Returns the bounds of the icon.
55 gfx::Rect GetIconBounds() const; 55 gfx::Rect GetIconBounds() const;
56 56
57 // Called when user started dragging the shelf button.
58 void OnDragStarted();
59
57 // Overrides to views::CustomButton: 60 // Overrides to views::CustomButton:
58 void ShowContextMenu(const gfx::Point& p, 61 void ShowContextMenu(const gfx::Point& p,
59 ui::MenuSourceType source_type) override; 62 ui::MenuSourceType source_type) override;
60 63
61 // View override - needed by unit test. 64 // View override - needed by unit test.
62 void OnMouseCaptureLost() override; 65 void OnMouseCaptureLost() override;
63 66
64 protected: 67 protected:
65 // View overrides: 68 // View overrides:
66 const char* GetClassName() const override; 69 const char* GetClassName() const override;
67 bool OnMousePressed(const ui::MouseEvent& event) override; 70 bool OnMousePressed(const ui::MouseEvent& event) override;
68 void OnMouseReleased(const ui::MouseEvent& event) override; 71 void OnMouseReleased(const ui::MouseEvent& event) override;
69 bool OnMouseDragged(const ui::MouseEvent& event) override; 72 bool OnMouseDragged(const ui::MouseEvent& event) override;
70 void GetAccessibleState(ui::AXViewState* state) override; 73 void GetAccessibleState(ui::AXViewState* state) override;
71 void Layout() override; 74 void Layout() override;
72 void ChildPreferredSizeChanged(views::View* child) override; 75 void ChildPreferredSizeChanged(views::View* child) override;
73 void OnFocus() override; 76 void OnFocus() override;
74 void OnBlur() override; 77 void OnBlur() override;
75 void OnPaint(gfx::Canvas* canvas) override; 78 void OnPaint(gfx::Canvas* canvas) override;
76 79
77 // ui::EventHandler overrides: 80 // ui::EventHandler overrides:
78 void OnGestureEvent(ui::GestureEvent* event) override; 81 void OnGestureEvent(ui::GestureEvent* event) override;
79 82
83 // views::CustomButton overrides:
84 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override;
85 bool ShouldEnterPushedState(const ui::Event& event) override;
86 bool ShouldShowInkDropHighlight() const override;
87 void NotifyClick(const ui::Event& event) override;
88
80 // Sets the icon image with a shadow. 89 // Sets the icon image with a shadow.
81 void SetShadowedImage(const gfx::ImageSkia& bitmap); 90 void SetShadowedImage(const gfx::ImageSkia& bitmap);
82 91
83 private: 92 private:
84 class BarView; 93 class BarView;
85 94
86 // Updates the parts of the button to reflect the current |state_| and 95 // Updates the parts of the button to reflect the current |state_| and
87 // alignment. This may add or remove views, layout and paint. 96 // alignment. This may add or remove views, layout and paint.
88 void UpdateState(); 97 void UpdateState();
89 98
(...skipping 17 matching lines...) Expand all
107 // If non-null the destuctor sets this to true. This is set while the menu is 116 // If non-null the destuctor sets this to true. This is set while the menu is
108 // showing and used to detect if the menu was deleted while running. 117 // showing and used to detect if the menu was deleted while running.
109 bool* destroyed_flag_; 118 bool* destroyed_flag_;
110 119
111 DISALLOW_COPY_AND_ASSIGN(ShelfButton); 120 DISALLOW_COPY_AND_ASSIGN(ShelfButton);
112 }; 121 };
113 122
114 } // namespace ash 123 } // namespace ash
115 124
116 #endif // ASH_SHELF_SHELF_BUTTON_H_ 125 #endif // ASH_SHELF_SHELF_BUTTON_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698