| Index: ui/views/focus/focus_traversal_unittest.cc
|
| diff --git a/ui/views/focus/focus_traversal_unittest.cc b/ui/views/focus/focus_traversal_unittest.cc
|
| index 352b4e481d0fdac354983ca47cf3ad9eef904d5d..6516bc13d14b76b69c2d9374817a39e037645108 100644
|
| --- a/ui/views/focus/focus_traversal_unittest.cc
|
| +++ b/ui/views/focus/focus_traversal_unittest.cc
|
| @@ -139,11 +139,11 @@ class BorderView : public NativeViewHost {
|
| }
|
|
|
| virtual internal::RootView* GetContentsRootView() {
|
| - return static_cast<internal::RootView*>(widget_->GetRootView());
|
| + return static_cast<internal::RootView*>(widget_.GetRootView());
|
| }
|
|
|
| FocusTraversable* GetFocusTraversable() override {
|
| - return static_cast<internal::RootView*>(widget_->GetRootView());
|
| + return static_cast<internal::RootView*>(widget_.GetRootView());
|
| }
|
|
|
| void ViewHierarchyChanged(
|
| @@ -151,27 +151,24 @@ class BorderView : public NativeViewHost {
|
| NativeViewHost::ViewHierarchyChanged(details);
|
|
|
| if (details.child == this && details.is_add) {
|
| - if (!widget_) {
|
| - widget_ = base::MakeUnique<Widget>();
|
| - Widget::InitParams params(Widget::InitParams::TYPE_CONTROL);
|
| - params.parent = details.parent->GetWidget()->GetNativeView();
|
| - params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
|
| - widget_->Init(params);
|
| - widget_->SetFocusTraversableParentView(this);
|
| - widget_->SetContentsView(child_);
|
| - }
|
| + Widget::InitParams params(Widget::InitParams::TYPE_CONTROL);
|
| + params.parent = details.parent->GetWidget()->GetNativeView();
|
| + params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
|
| + widget_.Init(params);
|
| + widget_.SetFocusTraversableParentView(this);
|
| + widget_.SetContentsView(child_);
|
|
|
| // We have been added to a view hierarchy, attach the native view.
|
| - Attach(widget_->GetNativeView());
|
| + Attach(widget_.GetNativeView());
|
| // Also update the FocusTraversable parent so the focus traversal works.
|
| - static_cast<internal::RootView*>(widget_->GetRootView())->
|
| + static_cast<internal::RootView*>(widget_.GetRootView())->
|
| SetFocusTraversableParent(GetWidget()->GetFocusTraversable());
|
| }
|
| }
|
|
|
| private:
|
| View* child_;
|
| - std::unique_ptr<Widget> widget_;
|
| + Widget widget_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(BorderView);
|
| };
|
|
|