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

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

Issue 2744463002: Add VectorIconButton functionality to ImageButton. (Closed)
Patch Set: WIP: use observer 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_BUTTON_OBSERVER_H_
6 #define UI_VIEWS_VECTOR_ICON_IMAGE_BUTTON_OBSERVER_H_
7
8 #include "base/macros.h"
9 #include "third_party/skia/include/core/SkColor.h"
10 #include "ui/gfx/vector_icon_types.h"
11 #include "ui/views/view_observer.h"
12
13 namespace ui {
14 class NativeTheme;
15 }
16
17 namespace views {
18
19 class ButtonListener;
20 class ImageButton;
21 class View;
22
23 class VIEWS_EXPORT VectorIconImageButtonObserver : public ViewObserver {
sky 2017/03/13 16:21:57 How about naming this VectorIconImageUpdater or so
Evan Stade 2017/03/15 15:04:02 with ViewObserver I'm no longer sure this interfac
bruthig 2017/03/15 15:53:20 I think the value of this class will grow as it ge
Evan Stade 2017/03/15 16:59:25 I see. I think this is breaking the Chromium inher
Peter Kasting 2017/03/15 18:03:02 FWIW, our UI code defies that rule in 8 billion pl
Peter Kasting 2017/03/15 18:16:45 Evan sez: we've fixed a lot of these and are tryin
bruthig 2017/03/15 21:41:21 The FindBarViewButtonObserver found in find_bar_vi
Evan Stade 2017/03/15 22:46:20 That's kind of an elaborate way to get around mult
Bret 2017/03/15 23:39:20 To bruthig's suggestion, I thought about doing som
24 public:
25 VectorIconImageButtonObserver() = default;
26
27 // ViewObserver:
28 void OnThemeChanged(View* view) override;
29 void OnNativeThemeChanged(View* view, const ui::NativeTheme* theme) override;
30
31 private:
32 void UpdateButtonImages(View* view);
33 virtual const gfx::VectorIcon& GetVectorIcon(View* view) const = 0;
sky 2017/03/13 16:21:57 Having these two functions private certainly works
34 virtual SkColor GetVectorIconColor() const;
sky 2017/03/13 16:21:57 Add descriptions of these functions.
35
36 DISALLOW_COPY_AND_ASSIGN(VectorIconImageButtonObserver);
37 };
38
39 VIEWS_EXPORT ImageButton* CreateDefaultVectorIconButton(
sky 2017/03/13 16:21:57 Please add a comment. Also, make this return a uni
Bret 2017/03/15 00:07:13 The name is good. I'm not sure how unique_ptr inte
sky 2017/03/15 15:05:11 Calling release() still makes ownership clear. But
40 const gfx::VectorIcon& icon,
41 VectorIconImageButtonObserver* observer,
sky 2017/03/13 16:21:57 WDYT of making the button own the observer? I real
Bret 2017/03/15 00:07:13 I wanted to avoid giving ImageButton knowledge of
sky 2017/03/15 15:05:11 Sorry for not being clear. I was suggesting owners
Bret 2017/03/15 23:39:19 I did this and it works well.
42 ButtonListener* listener);
43 }
44
45 #endif // UI_VIEWS_VECTOR_ICON_IMAGE_BUTTON_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698