Chromium Code Reviews| 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 // Initialize the Widget, adding some meaningful default InitParams. | |
|
tapted
2015/08/03 01:10:46
remove
jackhou1
2015/08/03 05:09:50
Done.
| |
| 124 void TestDesktopWidgetDelegate::InitWidget(Widget::InitParams init_params) { | |
| 125 init_params.delegate = this; | |
| 126 #if !defined(OS_CHROMEOS) | |
| 127 init_params.native_widget = new PlatformDesktopNativeWidget(widget_); | |
| 128 #endif | |
| 129 init_params.bounds = initial_bounds_; | |
| 130 widget_->Init(init_params); | |
| 131 } | |
| 132 | |
| 133 // WidgetDelegate s: | |
|
tapted
2015/08/03 01:10:46
remove
jackhou1
2015/08/03 05:09:50
Done.
| |
| 134 void TestDesktopWidgetDelegate::WindowClosing() { | |
| 135 window_closing_count_++; | |
| 136 widget_ = nullptr; | |
| 137 } | |
| 138 | |
| 139 Widget* TestDesktopWidgetDelegate::GetWidget() { | |
| 140 return widget_; | |
| 141 } | |
| 142 | |
| 143 const Widget* TestDesktopWidgetDelegate::GetWidget() const { | |
| 144 return widget_; | |
| 145 } | |
| 146 | |
| 147 View* TestDesktopWidgetDelegate::GetContentsView() { | |
| 148 return contents_view_ ? contents_view_ : WidgetDelegate::GetContentsView(); | |
| 149 } | |
| 150 | |
| 151 bool TestDesktopWidgetDelegate::ShouldAdvanceFocusToTopLevelWidget() const { | |
| 152 return true; // Same default as DefaultWidgetDelegate in widget.cc. | |
| 153 } | |
| 154 | |
| 114 } // namespace test | 155 } // namespace test |
| 115 } // namespace views | 156 } // namespace views |
| OLD | NEW |