OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 COMPONENTS_CONSTRAINED_WINDOW_NATIVE_WEB_CONTENTS_MODAL_DIALOG_MANAGER_V
IEWS_H_ | 5 #ifndef COMPONENTS_CONSTRAINED_WINDOW_NATIVE_WEB_CONTENTS_MODAL_DIALOG_MANAGER_V
IEWS_H_ |
6 #define COMPONENTS_CONSTRAINED_WINDOW_NATIVE_WEB_CONTENTS_MODAL_DIALOG_MANAGER_V
IEWS_H_ | 6 #define COMPONENTS_CONSTRAINED_WINDOW_NATIVE_WEB_CONTENTS_MODAL_DIALOG_MANAGER_V
IEWS_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 // ordering in e.g. the print preview dialog. OnWidgetDestroying is overridden | 54 // ordering in e.g. the print preview dialog. OnWidgetDestroying is overridden |
55 // because OnWidgetClosing is *only* invoked on explicit close, not when the | 55 // because OnWidgetClosing is *only* invoked on explicit close, not when the |
56 // widget is implicitly destroyed due to its parent being closed. This | 56 // widget is implicitly destroyed due to its parent being closed. This |
57 // situation occurs with app windows. WidgetClosing removes the observer, so | 57 // situation occurs with app windows. WidgetClosing removes the observer, so |
58 // only one of these two functions is ever invoked for a given widget. | 58 // only one of these two functions is ever invoked for a given widget. |
59 void OnWidgetClosing(views::Widget* widget) override; | 59 void OnWidgetClosing(views::Widget* widget) override; |
60 void OnWidgetDestroying(views::Widget* widget) override; | 60 void OnWidgetDestroying(views::Widget* widget) override; |
61 void HostChanged(web_modal::WebContentsModalDialogHost* new_host) override; | 61 void HostChanged(web_modal::WebContentsModalDialogHost* new_host) override; |
62 gfx::NativeWindow dialog() override; | 62 gfx::NativeWindow dialog() override; |
63 | 63 |
| 64 protected: |
| 65 web_modal::SingleWebContentsDialogManagerDelegate* native_delegate() { |
| 66 return native_delegate_; |
| 67 } |
| 68 |
| 69 // By default just calls widget->Show() or Hide(), but allows a derived class |
| 70 // to override in order to hide an alternate way (e.g. if the default hide |
| 71 // would tear down attached dialogs too early). |
| 72 virtual void ShowWidget(views::Widget* widget); |
| 73 virtual void HideWidget(views::Widget* widget); |
| 74 |
| 75 static views::Widget* GetWidget(gfx::NativeWindow dialog); |
| 76 |
64 private: | 77 private: |
65 static views::Widget* GetWidget(gfx::NativeWindow dialog); | |
66 void WidgetClosing(views::Widget* widget); | 78 void WidgetClosing(views::Widget* widget); |
67 | 79 |
68 web_modal::SingleWebContentsDialogManagerDelegate* native_delegate_; | 80 web_modal::SingleWebContentsDialogManagerDelegate* native_delegate_; |
69 gfx::NativeWindow dialog_; | 81 gfx::NativeWindow dialog_; |
70 web_modal::WebContentsModalDialogHost* host_; | 82 web_modal::WebContentsModalDialogHost* host_; |
71 bool host_destroying_; | 83 bool host_destroying_; |
72 std::set<views::Widget*> observed_widgets_; | 84 std::set<views::Widget*> observed_widgets_; |
73 std::set<views::Widget*> shown_widgets_; | 85 std::set<views::Widget*> shown_widgets_; |
74 | 86 |
75 DISALLOW_COPY_AND_ASSIGN(NativeWebContentsModalDialogManagerViews); | 87 DISALLOW_COPY_AND_ASSIGN(NativeWebContentsModalDialogManagerViews); |
76 }; | 88 }; |
77 | 89 |
78 } // namespace constrained_window | 90 } // namespace constrained_window |
79 | 91 |
80 #endif // COMPONENTS_CONSTRAINED_WINDOW_NATIVE_WEB_CONTENTS_MODAL_DIALOG_MANAGE
R_VIEWS_H_ | 92 #endif // COMPONENTS_CONSTRAINED_WINDOW_NATIVE_WEB_CONTENTS_MODAL_DIALOG_MANAGE
R_VIEWS_H_ |
OLD | NEW |