| OLD | NEW |
| (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_ |
| OLD | NEW |