Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(359)

Side by Side Diff: components/constrained_window/native_web_contents_modal_dialog_manager_views.h

Issue 2087643003: Move web modal dialog manager files into the constrained_window component. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase? Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 COMPONENTS_CONSTRAINED_WINDOW_NATIVE_WEB_CONTENTS_MODAL_DIALOG_MANAGER_V IEWS_H_
6 #define CHROME_BROWSER_UI_VIEWS_NATIVE_WEB_CONTENTS_MODAL_DIALOG_MANAGER_VIEWS_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"
11 #include "components/web_modal/modal_dialog_host.h" 11 #include "components/web_modal/modal_dialog_host.h"
12 #include "components/web_modal/single_web_contents_dialog_manager.h" 12 #include "components/web_modal/single_web_contents_dialog_manager.h"
13 #include "ui/gfx/native_widget_types.h" 13 #include "ui/gfx/native_widget_types.h"
14 #include "ui/views/widget/widget_observer.h" 14 #include "ui/views/widget/widget_observer.h"
15 15
16 namespace views { 16 namespace views {
17 class Widget; 17 class Widget;
18 } 18 }
19 19
20 namespace constrained_window {
21
20 // Class for parenting a tab-modal views dialog off of a views browser. 22 // Class for parenting a tab-modal views dialog off of a views browser.
21 class NativeWebContentsModalDialogManagerViews 23 class NativeWebContentsModalDialogManagerViews
22 : public web_modal::SingleWebContentsDialogManager, 24 : public web_modal::SingleWebContentsDialogManager,
23 public web_modal::ModalDialogHostObserver, 25 public web_modal::ModalDialogHostObserver,
24 public views::WidgetObserver { 26 public views::WidgetObserver {
25 public: 27 public:
26 NativeWebContentsModalDialogManagerViews( 28 NativeWebContentsModalDialogManagerViews(
27 gfx::NativeWindow dialog, 29 gfx::NativeWindow dialog,
28 web_modal::SingleWebContentsDialogManagerDelegate* native_delegate); 30 web_modal::SingleWebContentsDialogManagerDelegate* native_delegate);
29 31
(...skipping 22 matching lines...) Expand all
52 // ordering in e.g. the print preview dialog. OnWidgetDestroying is overridden 54 // ordering in e.g. the print preview dialog. OnWidgetDestroying is overridden
53 // because OnWidgetClosing is *only* invoked on explicit close, not when the 55 // because OnWidgetClosing is *only* invoked on explicit close, not when the
54 // widget is implicitly destroyed due to its parent being closed. This 56 // widget is implicitly destroyed due to its parent being closed. This
55 // situation occurs with app windows. WidgetClosing removes the observer, so 57 // situation occurs with app windows. WidgetClosing removes the observer, so
56 // 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.
57 void OnWidgetClosing(views::Widget* widget) override; 59 void OnWidgetClosing(views::Widget* widget) override;
58 void OnWidgetDestroying(views::Widget* widget) override; 60 void OnWidgetDestroying(views::Widget* widget) override;
59 void HostChanged(web_modal::WebContentsModalDialogHost* new_host) override; 61 void HostChanged(web_modal::WebContentsModalDialogHost* new_host) override;
60 gfx::NativeWindow dialog() override; 62 gfx::NativeWindow dialog() override;
61 63
64 protected:
65 web_modal::SingleWebContentsDialogManagerDelegate* native_delegate() {
tapted 2016/06/29 03:02:45 This should stay in the follow-up CL, along with t
Patti Lor 2016/07/13 03:09:41 Done.
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
62 private: 77 private:
63 static views::Widget* GetWidget(gfx::NativeWindow dialog);
64 void WidgetClosing(views::Widget* widget); 78 void WidgetClosing(views::Widget* widget);
65 79
66 web_modal::SingleWebContentsDialogManagerDelegate* native_delegate_; 80 web_modal::SingleWebContentsDialogManagerDelegate* native_delegate_;
67 gfx::NativeWindow dialog_; 81 gfx::NativeWindow dialog_;
68 web_modal::WebContentsModalDialogHost* host_; 82 web_modal::WebContentsModalDialogHost* host_;
69 bool host_destroying_; 83 bool host_destroying_;
70 std::set<views::Widget*> observed_widgets_; 84 std::set<views::Widget*> observed_widgets_;
71 std::set<views::Widget*> shown_widgets_; 85 std::set<views::Widget*> shown_widgets_;
72 86
73 DISALLOW_COPY_AND_ASSIGN(NativeWebContentsModalDialogManagerViews); 87 DISALLOW_COPY_AND_ASSIGN(NativeWebContentsModalDialogManagerViews);
74 }; 88 };
75 89
76 #endif // CHROME_BROWSER_UI_VIEWS_NATIVE_WEB_CONTENTS_MODAL_DIALOG_MANAGER_VIEW S_H_ 90 } // namespace constrained_window
91
92 #endif // COMPONENTS_CONSTRAINED_WINDOW_NATIVE_WEB_CONTENTS_MODAL_DIALOG_MANAGE R_VIEWS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698