OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/child_modal_window.h" | 5 #include "ui/views/test/child_modal_window.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" // ASCIIToUTF16 | 7 #include "base/utf_string_conversions.h" // ASCIIToUTF16 |
8 #include "ui/aura/window.h" | 8 #include "ui/aura/window.h" |
9 #include "ui/gfx/canvas.h" | 9 #include "ui/gfx/canvas.h" |
10 #include "ui/views/background.h" | 10 #include "ui/views/background.h" |
11 #include "ui/views/controls/button/text_button.h" | 11 #include "ui/views/controls/button/label_button.h" |
12 #include "ui/views/controls/native/native_view_host.h" | 12 #include "ui/views/controls/native/native_view_host.h" |
13 #include "ui/views/controls/textfield/textfield.h" | 13 #include "ui/views/controls/textfield/textfield.h" |
14 #include "ui/views/corewm/window_modality_controller.h" | 14 #include "ui/views/corewm/window_modality_controller.h" |
15 #include "ui/views/widget/widget.h" | 15 #include "ui/views/widget/widget.h" |
16 #include "ui/views/widget/widget_delegate.h" | 16 #include "ui/views/widget/widget_delegate.h" |
17 | 17 |
18 namespace views { | 18 namespace views { |
19 namespace test { | 19 namespace test { |
20 | 20 |
21 namespace { | 21 namespace { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 | 101 |
102 bool ChildModalWindow::CanResize() const { | 102 bool ChildModalWindow::CanResize() const { |
103 return false; | 103 return false; |
104 } | 104 } |
105 | 105 |
106 ui::ModalType ChildModalWindow::GetModalType() const { | 106 ui::ModalType ChildModalWindow::GetModalType() const { |
107 return ui::MODAL_TYPE_CHILD; | 107 return ui::MODAL_TYPE_CHILD; |
108 } | 108 } |
109 | 109 |
110 ChildModalParent::ChildModalParent(gfx::NativeView context) | 110 ChildModalParent::ChildModalParent(gfx::NativeView context) |
111 : ALLOW_THIS_IN_INITIALIZER_LIST(button_(new NativeTextButton( | 111 : ALLOW_THIS_IN_INITIALIZER_LIST(button_(new LabelButton( |
112 this, ASCIIToUTF16("Show/Hide Child Modal Window")))), | 112 this, ASCIIToUTF16("Show/Hide Child Modal Window")))), |
113 textfield_(new Textfield), | 113 textfield_(new Textfield), |
114 host_(new NativeViewHost), | 114 host_(new NativeViewHost), |
115 modal_parent_(NULL), | 115 modal_parent_(NULL), |
116 child_(NULL) { | 116 child_(NULL) { |
117 Widget* widget = new Widget; | 117 Widget* widget = new Widget; |
118 Widget::InitParams params(Widget::InitParams::TYPE_CONTROL); | 118 Widget::InitParams params(Widget::InitParams::TYPE_CONTROL); |
119 params.context = context; | 119 params.context = context; |
120 widget->Init(params); | 120 widget->Init(params); |
121 widget->GetRootView()->set_background( | 121 widget->GetRootView()->set_background( |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 | 209 |
210 void ChildModalParent::OnWidgetDestroying(Widget* widget) { | 210 void ChildModalParent::OnWidgetDestroying(Widget* widget) { |
211 if (child_) { | 211 if (child_) { |
212 DCHECK_EQ(child_, widget); | 212 DCHECK_EQ(child_, widget); |
213 child_ = NULL; | 213 child_ = NULL; |
214 } | 214 } |
215 } | 215 } |
216 | 216 |
217 } // namespace test | 217 } // namespace test |
218 } // namespace views | 218 } // namespace views |
OLD | NEW |