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

Side by Side Diff: chrome/browser/ui/views/bar_control_button.h

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: Merged with master / https://codereview.chromium.org/1494433003. 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 unified diff | Download patch
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 #ifndef CHROME_BROWSER_UI_VIEWS_BAR_CONTROL_BUTTON_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_BAR_CONTROL_BUTTON_H_
6 #define CHROME_BROWSER_UI_VIEWS_BAR_CONTROL_BUTTON_H_ 6 #define CHROME_BROWSER_UI_VIEWS_BAR_CONTROL_BUTTON_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h"
10 #include "ui/views/animation/ink_drop_host.h" 11 #include "ui/views/animation/ink_drop_host.h"
11 #include "ui/views/controls/button/image_button.h" 12 #include "ui/views/controls/button/image_button.h"
12 13
13 namespace gfx { 14 namespace gfx {
14 enum class VectorIconId; 15 enum class VectorIconId;
15 } 16 }
16 17
17 namespace views {
18 class InkDropAnimationController;
19 }
20
21 // A class for buttons that control bars (find bar, download shelf, etc.). The 18 // A class for buttons that control bars (find bar, download shelf, etc.). The
22 // button has an image and no text. 19 // button has an image and no text.
23 class BarControlButton : public views::ImageButton, public views::InkDropHost { 20 class BarControlButton : public views::ImageButton, public views::InkDropHost {
24 public: 21 public:
25 explicit BarControlButton(views::ButtonListener* listener); 22 explicit BarControlButton(views::ButtonListener* listener);
26 ~BarControlButton() override; 23 ~BarControlButton() override;
27 24
28 // Sets the icon to display and provides a callback which should return the 25 // Sets the icon to display and provides a callback which should return the
29 // text color from which to derive this icon's color. 26 // text color from which to derive this icon's color.
30 void SetIcon(gfx::VectorIconId id, 27 void SetIcon(gfx::VectorIconId id,
31 const base::Callback<SkColor(void)>& get_text_color_callback); 28 const base::Callback<SkColor(void)>& get_text_color_callback);
32 29
33 // views::ImageButton: 30 // views::ImageButton:
34 void OnThemeChanged() override; 31 void OnThemeChanged() override;
35 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; 32 void OnNativeThemeChanged(const ui::NativeTheme* theme) override;
36 void Layout() override;
37 bool OnMousePressed(const ui::MouseEvent& event) override; 33 bool OnMousePressed(const ui::MouseEvent& event) override;
38 void OnGestureEvent(ui::GestureEvent* event) override;
39 void OnMouseReleased(const ui::MouseEvent& event) override;
40 void NotifyClick(const ui::Event& event) override;
41 34
42 private: 35 private:
43 // views::InkDropHost: 36 // views::InkDropHost:
44 void AddInkDropLayer(ui::Layer* ink_drop_layer) override; 37 void AddInkDropLayer(ui::Layer* ink_drop_layer) override;
45 void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override; 38 void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override;
46 gfx::Point CalculateInkDropCenter() const override; 39 gfx::Point CalculateInkDropCenter() const override;
47 40
48 gfx::VectorIconId id_; 41 gfx::VectorIconId id_;
49 base::Callback<SkColor(void)> get_text_color_callback_; 42 base::Callback<SkColor(void)> get_text_color_callback_;
50 43
51 // Animation controller for the ink drop ripple effect. 44 // Controls the visual feedback for the button state.
52 scoped_ptr<views::InkDropAnimationController> ink_drop_animation_controller_; 45 scoped_ptr<views::InkDropDelegate> ink_drop_delegate_;
varkha 2015/12/09 21:23:35 Do you need forward declaration for InkDropDelegat
bruthig 2015/12/11 22:09:45 Done.
53 46
54 DISALLOW_COPY_AND_ASSIGN(BarControlButton); 47 DISALLOW_COPY_AND_ASSIGN(BarControlButton);
55 }; 48 };
56 49
57 #endif // CHROME_BROWSER_UI_VIEWS_BAR_CONTROL_BUTTON_H_ 50 #endif // CHROME_BROWSER_UI_VIEWS_BAR_CONTROL_BUTTON_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/bar_control_button.cc » ('j') | chrome/browser/ui/views/toolbar/app_menu_button.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698