| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef ASH_TEST_CHILD_MODAL_WINDOW_H_ | 5 #ifndef ASH_TEST_CHILD_MODAL_WINDOW_H_ |
| 6 #define ASH_TEST_CHILD_MODAL_WINDOW_H_ | 6 #define ASH_TEST_CHILD_MODAL_WINDOW_H_ |
| 7 | 7 |
| 8 #include "ui/views/controls/button/button.h" | 8 #include "ui/views/controls/button/button.h" |
| 9 #include "ui/views/widget/widget_delegate.h" | 9 #include "ui/views/widget/widget_delegate.h" |
| 10 #include "ui/views/widget/widget_observer.h" | 10 #include "ui/views/widget/widget_observer.h" |
| 11 | 11 |
| 12 namespace views { | 12 namespace views { |
| 13 class LabelButton; | 13 class LabelButton; |
| 14 class NativeViewHost; | 14 class NativeViewHost; |
| 15 class Textfield; | 15 class Textfield; |
| 16 class View; | 16 class View; |
| 17 class Widget; | 17 class Widget; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace ash { | 20 namespace ash { |
| 21 namespace test { | 21 namespace test { |
| 22 | 22 |
| 23 void CreateChildModalParent(gfx::NativeView context); | 23 void CreateChildModalParent(gfx::NativeView context); |
| 24 | 24 |
| 25 class ChildModalParent : public views::WidgetDelegateView, | 25 class ChildModalParent : public views::WidgetDelegateView, |
| 26 public views::ButtonListener, | 26 public views::ButtonListener, |
| 27 public views::WidgetObserver { | 27 public views::WidgetObserver { |
| 28 public: | 28 public: |
| 29 ChildModalParent(gfx::NativeView context); | 29 ChildModalParent(gfx::NativeView context); |
| 30 virtual ~ChildModalParent(); | 30 ~ChildModalParent() override; |
| 31 | 31 |
| 32 void ShowChild(); | 32 void ShowChild(); |
| 33 gfx::NativeWindow GetModalParent() const; | 33 gfx::NativeWindow GetModalParent() const; |
| 34 gfx::NativeWindow GetChild() const; | 34 gfx::NativeWindow GetChild() const; |
| 35 | 35 |
| 36 private: | 36 private: |
| 37 views::Widget* CreateChild(); | 37 views::Widget* CreateChild(); |
| 38 | 38 |
| 39 // Overridden from views::WidgetDelegate: | 39 // Overridden from views::WidgetDelegate: |
| 40 virtual View* GetContentsView() override; | 40 View* GetContentsView() override; |
| 41 virtual base::string16 GetWindowTitle() const override; | 41 base::string16 GetWindowTitle() const override; |
| 42 virtual bool CanResize() const override; | 42 bool CanResize() const override; |
| 43 virtual void DeleteDelegate() override; | 43 void DeleteDelegate() override; |
| 44 | 44 |
| 45 // Overridden from views::View: | 45 // Overridden from views::View: |
| 46 virtual void Layout() override; | 46 void Layout() override; |
| 47 virtual void ViewHierarchyChanged( | 47 void ViewHierarchyChanged( |
| 48 const ViewHierarchyChangedDetails& details) override; | 48 const ViewHierarchyChangedDetails& details) override; |
| 49 | 49 |
| 50 // Overridden from ButtonListener: | 50 // Overridden from ButtonListener: |
| 51 virtual void ButtonPressed(views::Button* sender, | 51 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| 52 const ui::Event& event) override; | |
| 53 | 52 |
| 54 // Overridden from WidgetObserver: | 53 // Overridden from WidgetObserver: |
| 55 virtual void OnWidgetDestroying(views::Widget* widget) override; | 54 void OnWidgetDestroying(views::Widget* widget) override; |
| 56 | 55 |
| 57 // The button to toggle showing and hiding the child window. The child window | 56 // The button to toggle showing and hiding the child window. The child window |
| 58 // does not block input to this button. | 57 // does not block input to this button. |
| 59 views::LabelButton* button_; | 58 views::LabelButton* button_; |
| 60 | 59 |
| 61 // The text field to indicate the keyboard focus. | 60 // The text field to indicate the keyboard focus. |
| 62 views::Textfield* textfield_; | 61 views::Textfield* textfield_; |
| 63 | 62 |
| 64 // The host for the modal parent. | 63 // The host for the modal parent. |
| 65 views::NativeViewHost* host_; | 64 views::NativeViewHost* host_; |
| 66 | 65 |
| 67 // The modal parent of the child window. The child window blocks input to this | 66 // The modal parent of the child window. The child window blocks input to this |
| 68 // view. | 67 // view. |
| 69 gfx::NativeWindow modal_parent_; | 68 gfx::NativeWindow modal_parent_; |
| 70 | 69 |
| 71 // The child window. | 70 // The child window. |
| 72 views::Widget* child_; | 71 views::Widget* child_; |
| 73 | 72 |
| 74 DISALLOW_COPY_AND_ASSIGN(ChildModalParent); | 73 DISALLOW_COPY_AND_ASSIGN(ChildModalParent); |
| 75 }; | 74 }; |
| 76 | 75 |
| 77 } // namespace test | 76 } // namespace test |
| 78 } // namespace ash | 77 } // namespace ash |
| 79 | 78 |
| 80 #endif // ASH_TEST_CHILD_MODAL_WINDOW_H_ | 79 #endif // ASH_TEST_CHILD_MODAL_WINDOW_H_ |
| OLD | NEW |