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