summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/web_contents_modal_dialog_manager.h
diff options
context:
space:
mode:
authorwittman@chromium.org <wittman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-06 06:50:23 +0000
committerwittman@chromium.org <wittman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-06 06:50:23 +0000
commit51a2478710c9b2beda273832f2e4f4c825aa279a (patch)
tree77a926fd642222b69989250f7295d95d3cd42724 /chrome/browser/ui/web_contents_modal_dialog_manager.h
parent8cea789efbec4198ab2315ee2f49927523832d2f (diff)
downloadchromium_src-51a2478710c9b2beda273832f2e4f4c825aa279a.zip
chromium_src-51a2478710c9b2beda273832f2e4f4c825aa279a.tar.gz
chromium_src-51a2478710c9b2beda273832f2e4f4c825aa279a.tar.bz2
Refactor modality-specific behavior from ConstrainedWindowViews to WebContentsModalDialogManager
This CL moves the Views web contents modal dialog code towards the interface described in the associated bug. Similar changes for Gtk and Cocoa will be made in follow-on CLs. To that end, this CL contains the following detailed changes: - Introduce NativeWebContentsModalDialogManager for providing platform-specific UI functionality within WebContentsModalDialogManager, and implement NativeWebContentsModalDialogManagerViews. - Under Views, move to a model where WebContentsModalDialogManager listens for closing events rather than requiring notifications from the widget. Continue using the existing model on Gtk and Cocoa, pending refactoring there. - Provide a mechanism for disabling mouse-driven dialog movement on Widget. - Remove NativeConstrainedWindowDelegate and subclasses as they're no longer necessary due to the above two items. - Update tests to account for closing notification to WebContentsModalDialogManager being done from the event loop, rather than synchronously. - Add temporary ConstrainedWindowViews factory function to minimize code churn at construction sites during this refactoring. The next planned steps in this work are: - Refactor ConstrainedWindow subclasses under Gtk and Cocoa to listen for closing events rather than requiring notifications from the widget. - Refactor uses of WebContentsModalDialog interface to use platform-specific equivalents in platform-specific code and, in platform-independent code, invoke functionality via some other mechanism: platform_utils, WebContentsModalDialogManager, ???. Remove WebContentsModalDialog interface. - Generalize WebContentsModalDialogManagerDelegate positioning interface and write WebContentsModalDialogManager::ShowDialog using the new interface. BUG=157161 Review URL: https://chromiumcodereview.appspot.com/12045037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@180904 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/web_contents_modal_dialog_manager.h')
-rw-r--r--chrome/browser/ui/web_contents_modal_dialog_manager.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/chrome/browser/ui/web_contents_modal_dialog_manager.h b/chrome/browser/ui/web_contents_modal_dialog_manager.h
index 3a392d4..9384095 100644
--- a/chrome/browser/ui/web_contents_modal_dialog_manager.h
+++ b/chrome/browser/ui/web_contents_modal_dialog_manager.h
@@ -7,8 +7,11 @@
#include <deque>
+#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/ui/native_web_contents_modal_dialog_manager.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_user_data.h"
+#include "ui/gfx/native_widget_types.h"
class WebContentsModalDialog;
class WebContentsModalDialogManagerDelegate;
@@ -23,6 +26,9 @@ class WebContentsModalDialogManager
WebContentsModalDialogManagerDelegate* delegate() const { return delegate_; }
void set_delegate(WebContentsModalDialogManagerDelegate* d) { delegate_ = d; }
+ static NativeWebContentsModalDialogManager* CreateNativeManager(
+ WebContentsModalDialogManager* manager);
+
// Adds the given dialog to the list of child dialogs. The dialog will notify
// via WillClose() when it is being destroyed.
void AddDialog(WebContentsModalDialog* dialog);
@@ -47,6 +53,9 @@ class WebContentsModalDialogManager
: manager_(manager) {}
void CloseAllDialogs() { manager_->CloseAllDialogs(); }
+ void ResetNativeManager(NativeWebContentsModalDialogManager* delegate) {
+ manager_->native_manager_.reset(delegate);
+ }
private:
WebContentsModalDialogManager* manager_;
@@ -86,6 +95,9 @@ class WebContentsModalDialogManager
// Delegate for notifying our owner about stuff. Not owned by us.
WebContentsModalDialogManagerDelegate* delegate_;
+ // Delegate for native UI-specific functions on the dialog.
+ scoped_ptr<NativeWebContentsModalDialogManager> native_manager_;
+
// All active dialogs.
WebContentsModalDialogList child_dialogs_;