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

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

Issue 1550443002: Pushed InkDropHost inheritence up to CustomButton. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed diff delta. Created 4 years, 11 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 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 "base/memory/scoped_ptr.h"
11 #include "ui/views/animation/ink_drop_host.h"
12 #include "ui/views/controls/button/image_button.h" 11 #include "ui/views/controls/button/image_button.h"
13 12
14 namespace gfx { 13 namespace gfx {
15 enum class VectorIconId; 14 enum class VectorIconId;
16 } 15 }
17 16
18 namespace views { 17 namespace views {
19 class InkDropDelegate; 18 class InkDropDelegate;
20 } 19 }
21 20
22 // A class for buttons that control bars (find bar, download shelf, etc.). The 21 // A class for buttons that control bars (find bar, download shelf, etc.). The
23 // button has an image and no text. 22 // button has an image and no text.
24 class BarControlButton : public views::ImageButton, public views::InkDropHost { 23 class BarControlButton : public views::ImageButton {
25 public: 24 public:
26 explicit BarControlButton(views::ButtonListener* listener); 25 explicit BarControlButton(views::ButtonListener* listener);
27 ~BarControlButton() override; 26 ~BarControlButton() override;
28 27
29 // Sets the icon to display and provides a callback which should return the 28 // Sets the icon to display and provides a callback which should return the
30 // text color from which to derive this icon's color. 29 // text color from which to derive this icon's color.
31 void SetIcon(gfx::VectorIconId id, 30 void SetIcon(gfx::VectorIconId id,
32 const base::Callback<SkColor(void)>& get_text_color_callback); 31 const base::Callback<SkColor(void)>& get_text_color_callback);
33 32
34 // views::ImageButton: 33 // views::ImageButton:
35 void OnThemeChanged() override; 34 void OnThemeChanged() override;
36 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; 35 void OnNativeThemeChanged(const ui::NativeTheme* theme) override;
37 bool OnMousePressed(const ui::MouseEvent& event) override; 36 bool OnMousePressed(const ui::MouseEvent& event) override;
38 37
39 private: 38 private:
40 // views::InkDropHost: 39 // views::ImageButton:
41 void AddInkDropLayer(ui::Layer* ink_drop_layer) override; 40 void AddInkDropLayer(ui::Layer* ink_drop_layer) override;
42 void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override; 41 void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override;
43 gfx::Point CalculateInkDropCenter() const override;
44 42
45 gfx::VectorIconId id_; 43 gfx::VectorIconId id_;
46 base::Callback<SkColor(void)> get_text_color_callback_; 44 base::Callback<SkColor(void)> get_text_color_callback_;
47 45
48 // Controls the visual feedback for the button state. 46 // Controls the visual feedback for the button state.
49 scoped_ptr<views::InkDropDelegate> ink_drop_delegate_; 47 scoped_ptr<views::InkDropDelegate> ink_drop_delegate_;
50 48
51 DISALLOW_COPY_AND_ASSIGN(BarControlButton); 49 DISALLOW_COPY_AND_ASSIGN(BarControlButton);
52 }; 50 };
53 51
54 #endif // CHROME_BROWSER_UI_VIEWS_BAR_CONTROL_BUTTON_H_ 52 #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') | ui/views/animation/ink_drop_host.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698