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 virtual ~ChildModalParent();
33 gfx::NativeWindow
GetModalParent() const;
34 gfx::NativeWindow
GetChild() const;
37 views::Widget
* CreateChild();
39 // Overridden from views::WidgetDelegate:
40 virtual View
* GetContentsView() OVERRIDE
;
41 virtual base::string16
GetWindowTitle() const OVERRIDE
;
42 virtual bool CanResize() const OVERRIDE
;
43 virtual void DeleteDelegate() OVERRIDE
;
45 // Overridden from views::View:
46 virtual void Layout() OVERRIDE
;
47 virtual void ViewHierarchyChanged(
48 const ViewHierarchyChangedDetails
& details
) OVERRIDE
;
50 // Overridden from ButtonListener:
51 virtual void ButtonPressed(views::Button
* sender
,
52 const ui::Event
& event
) OVERRIDE
;
54 // Overridden from WidgetObserver:
55 virtual void OnWidgetDestroying(views::Widget
* widget
) OVERRIDE
;
57 // The button to toggle showing and hiding the child window. The child window
58 // does not block input to this button.
59 views::LabelButton
* button_
;
61 // The text field to indicate the keyboard focus.
62 views::Textfield
* textfield_
;
64 // The host for the modal parent.
65 views::NativeViewHost
* host_
;
67 // The modal parent of the child window. The child window blocks input to this
69 gfx::NativeWindow modal_parent_
;
72 views::Widget
* child_
;
74 DISALLOW_COPY_AND_ASSIGN(ChildModalParent
);
80 #endif // ASH_TEST_CHILD_MODAL_WINDOW_H_