Commit 93a1cb90 authored by Allen Bauer's avatar Allen Bauer Committed by Commit Bot

Downsize DefaultWidgetDelegate.

DefaultWidgetDelegate descends from WidgetDelegate which already sets the private widget_ field and overrides GetWidget(). Adding yet another member field of the same thing seems redundant.

Bug: N/A
Change-Id: I6e5036fdf667540893c3c0104d0bc08da0003e1e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2216606Reviewed-by: default avatarRobert Liao <robliao@chromium.org>
Commit-Queue: Allen Bauer <kylixrd@chromium.org>
Cr-Commit-Position: refs/heads/master@{#772249}
parent 0fb05f74
......@@ -93,7 +93,7 @@ bool Widget::g_disable_activation_change_handling_ = false;
// WidgetDelegate is supplied.
class DefaultWidgetDelegate : public WidgetDelegate {
public:
explicit DefaultWidgetDelegate(Widget* widget) : widget_(widget) {
DefaultWidgetDelegate() {
// In most situations where a Widget is used without a delegate the Widget
// is used as a container, so that we want focus to advance to the top-level
// widget. A good example of this is the find bar.
......@@ -103,12 +103,8 @@ class DefaultWidgetDelegate : public WidgetDelegate {
// WidgetDelegate:
void DeleteDelegate() override { delete this; }
Widget* GetWidget() override { return widget_; }
const Widget* GetWidget() const override { return widget_; }
private:
Widget* widget_;
DISALLOW_COPY_AND_ASSIGN(DefaultWidgetDelegate);
};
......@@ -300,8 +296,7 @@ void Widget::Init(InitParams params) {
// ViewsDelegate::OnBeforeWidgetInit() may change `params.delegate` either
// by setting it to null or assigning a different value to it, so handle
// both cases.
auto default_widget_delegate =
std::make_unique<DefaultWidgetDelegate>(this);
auto default_widget_delegate = std::make_unique<DefaultWidgetDelegate>();
widget_delegate_ =
params.delegate ? params.delegate : default_widget_delegate.get();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment