OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/views/test/widget_test.h" | 5 #include "ui/views/test/widget_test.h" |
6 | 6 |
7 #include "ui/gfx/native_widget_types.h" | 7 #include "ui/gfx/native_widget_types.h" |
8 #include "ui/views/widget/root_view.h" | 8 #include "ui/views/widget/root_view.h" |
9 | 9 |
10 namespace views { | 10 namespace views { |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 } | 104 } |
105 | 105 |
106 View* WidgetTest::GetMouseMoveHandler(internal::RootView* root_view) { | 106 View* WidgetTest::GetMouseMoveHandler(internal::RootView* root_view) { |
107 return root_view->mouse_move_handler_; | 107 return root_view->mouse_move_handler_; |
108 } | 108 } |
109 | 109 |
110 View* WidgetTest::GetGestureHandler(internal::RootView* root_view) { | 110 View* WidgetTest::GetGestureHandler(internal::RootView* root_view) { |
111 return root_view->gesture_handler_; | 111 return root_view->gesture_handler_; |
112 } | 112 } |
113 | 113 |
| 114 TestDesktopWidgetDelegate::TestDesktopWidgetDelegate() : widget_(new Widget) { |
| 115 } |
| 116 |
| 117 TestDesktopWidgetDelegate::~TestDesktopWidgetDelegate() { |
| 118 if (widget_) |
| 119 widget_->CloseNow(); |
| 120 EXPECT_FALSE(widget_); |
| 121 } |
| 122 |
| 123 void TestDesktopWidgetDelegate::InitWidget(Widget::InitParams init_params) { |
| 124 init_params.delegate = this; |
| 125 #if !defined(OS_CHROMEOS) |
| 126 init_params.native_widget = new PlatformDesktopNativeWidget(widget_); |
| 127 #endif |
| 128 init_params.bounds = initial_bounds_; |
| 129 widget_->Init(init_params); |
| 130 } |
| 131 |
| 132 void TestDesktopWidgetDelegate::WindowClosing() { |
| 133 window_closing_count_++; |
| 134 widget_ = nullptr; |
| 135 } |
| 136 |
| 137 Widget* TestDesktopWidgetDelegate::GetWidget() { |
| 138 return widget_; |
| 139 } |
| 140 |
| 141 const Widget* TestDesktopWidgetDelegate::GetWidget() const { |
| 142 return widget_; |
| 143 } |
| 144 |
| 145 View* TestDesktopWidgetDelegate::GetContentsView() { |
| 146 return contents_view_ ? contents_view_ : WidgetDelegate::GetContentsView(); |
| 147 } |
| 148 |
| 149 bool TestDesktopWidgetDelegate::ShouldAdvanceFocusToTopLevelWidget() const { |
| 150 return true; // Same default as DefaultWidgetDelegate in widget.cc. |
| 151 } |
| 152 |
114 } // namespace test | 153 } // namespace test |
115 } // namespace views | 154 } // namespace views |
OLD | NEW |