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

Unified Diff: ui/views/focus/focus_traversal_unittest.cc

Issue 2482193003: views_unittests: Fix FocusTraversalTest's BorderView::widget_ deletion. (Closed)
Patch Set: Rebase. Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 7a43eef857d3ed05941fa4da830310a637eb231e..f357f7c1c76acafd6b463b57b816f51a21353738 100644
--- a/ui/views/focus/focus_traversal_unittest.cc
+++ b/ui/views/focus/focus_traversal_unittest.cc
@@ -132,20 +132,11 @@ class PaneView : public View, public FocusTraversable {
// view hierarchy.
class BorderView : public NativeViewHost {
public:
- explicit BorderView(View* child) : child_(child), widget_(NULL) {
+ explicit BorderView(View* child) : child_(child) {
DCHECK(child);
SetFocusBehavior(FocusBehavior::NEVER);
}
- ~BorderView() override {
- // TODO: ifdef should not be necessary. NativeWidgetMac has different
- // ownership semantics: http://crbug.com/663418.
-#if !defined(OS_MACOSX)
- if (widget_)
- widget_->CloseNow();
-#endif
- }
-
virtual internal::RootView* GetContentsRootView() {
return static_cast<internal::RootView*>(widget_->GetRootView());
}
@@ -160,9 +151,10 @@ class BorderView : public NativeViewHost {
if (details.child == this && details.is_add) {
if (!widget_) {
- widget_ = new Widget;
+ widget_.reset(new Widget);
sky 2016/11/10 04:16:10 Use MakeUnique (see threads on chromium-dev for de
Patti Lor 2016/11/10 05:01:56 Done, thanks for the FYI!
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_);
@@ -178,7 +170,7 @@ class BorderView : public NativeViewHost {
private:
View* child_;
- Widget* widget_;
+ std::unique_ptr<Widget> widget_;
DISALLOW_COPY_AND_ASSIGN(BorderView);
};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698