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

Side by Side Diff: ui/views/controls/button/vector_icon_image_updater.h

Issue 2744463002: Add VectorIconButton functionality to ImageButton. (Closed)
Patch Set: wip: address high-level comments Created 3 years, 9 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
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef UI_VIEWS_VECTOR_ICON_IMAGE_UPDATER_H_
6 #define UI_VIEWS_VECTOR_ICON_IMAGE_UPDATER_H_
7
8 #include <memory>
9
10 #include "base/macros.h"
11 #include "third_party/skia/include/core/SkColor.h"
12 #include "ui/gfx/vector_icon_types.h"
13 #include "ui/views/view_observer.h"
14
15 namespace ui {
16 class NativeTheme;
17 }
18
19 namespace views {
20
21 class ButtonListener;
22 class ImageButton;
23 class View;
24
25 // TODO: comments in this file
26 class VIEWS_EXPORT VectorIconImageUpdater : public ViewObserver {
27 public:
28 VectorIconImageUpdater(const gfx::VectorIcon& icon);
29
30 void Attach(ImageButton* owner_button);
31
32 void SetIcon(const gfx::VectorIcon& icon);
33
34 protected:
35 virtual SkColor GetVectorIconColor() const;
36
37 private:
38 // ViewObserver:
39 void OnThemeChanged(View* observed_view) override;
40 void OnNativeThemeChanged(View* observed_view,
41 const ui::NativeTheme* theme) override;
42 void OnViewIsDeleting(View* observed_view) override;
43
44 void UpdateButtonImages();
45
46 ImageButton* owner_button_;
47 const gfx::VectorIcon* icon_;
48
49 DISALLOW_COPY_AND_ASSIGN(VectorIconImageUpdater);
50 };
51
52 VIEWS_EXPORT ImageButton* CreateImageButtonWithVectorIcon(
53 const gfx::VectorIcon& icon,
54 ButtonListener* listener);
55
56 VIEWS_EXPORT ImageButton* CreateImageButtonWithImageUpdater(
57 VectorIconImageUpdater* updater,
58 ButtonListener* listener);
59
60 } // namespace views
61
62 #endif // UI_VIEWS_VECTOR_ICON_IMAGE_UPDATER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698