1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef ASH_TEST_CHILD_MODAL_WINDOW_H_
6 #define ASH_TEST_CHILD_MODAL_WINDOW_H_
8 #include "ui/views/controls/button/button.h"
9 #include "ui/views/widget/widget_delegate.h"
10 #include "ui/views/widget/widget_observer.h"
23 void CreateChildModalParent(gfx::NativeView context
);
25 class ChildModalParent
: public views::WidgetDelegateView
,
26 public views::ButtonListener
,
27 public views::WidgetObserver
{
29 ChildModalParent(gfx::NativeView context
);
30 ~ChildModalParent() override
;
33 gfx::NativeWindow
GetModalParent() const;
34 gfx::NativeWindow
GetChild() const;
37 views::Widget
* CreateChild();
39 // Overridden from views::WidgetDelegate:
40 View
* GetContentsView() override
;
41 base::string16
GetWindowTitle() const override
;
42 bool CanResize() const override
;
43 void DeleteDelegate() override
;
45 // Overridden from views::View:
46 void Layout() override
;
47 void ViewHierarchyChanged(
48 const ViewHierarchyChangedDetails
& details
) override
;
50 // Overridden from ButtonListener:
51 void ButtonPressed(views::Button
* sender
, const ui::Event
& event
) override
;
53 // Overridden from WidgetObserver:
54 void OnWidgetDestroying(views::Widget
* widget
) override
;
56 // The button to toggle showing and hiding the child window. The child window
57 // does not block input to this button.
58 views::LabelButton
* button_
;
60 // The text field to indicate the keyboard focus.
61 views::Textfield
* textfield_
;
63 // The host for the modal parent.
64 views::NativeViewHost
* host_
;
66 // The modal parent of the child window. The child window blocks input to this
68 gfx::NativeWindow modal_parent_
;
71 views::Widget
* child_
;
73 DISALLOW_COPY_AND_ASSIGN(ChildModalParent
);
79 #endif // ASH_TEST_CHILD_MODAL_WINDOW_H_