diff options
author | wittman@chromium.org <wittman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-20 18:39:16 +0000 |
---|---|---|
committer | wittman@chromium.org <wittman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-20 18:39:16 +0000 |
commit | 5c2c77944f290e7f80ba8e15e6ec0c4e1c42dafa (patch) | |
tree | 8f80ce3e78a0ef2e408c27699f94cd2fb88e07f0 /components/web_modal | |
parent | e9cab6586a22c4ed8d7d974057be955347e72920 (diff) | |
download | chromium_src-5c2c77944f290e7f80ba8e15e6ec0c4e1c42dafa.zip chromium_src-5c2c77944f290e7f80ba8e15e6ec0c4e1c42dafa.tar.gz chromium_src-5c2c77944f290e7f80ba8e15e6ec0c4e1c42dafa.tar.bz2 |
Add NativeWebContentsModalDialogManager::HostChanged()
Add a mechanism to notify platform-specific web contents modal dialog
managers that the hosting view has changed. To be used by future changes
to support a single host observer for all dialogs on a WebContents, rather
than one per dialog.
BUG=271746
R=asargent@chromium.org, joi@chromium.org, sky@chromium.org
Review URL: https://codereview.chromium.org/22897008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@218524 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components/web_modal')
4 files changed, 15 insertions, 1 deletions
diff --git a/components/web_modal/native_web_contents_modal_dialog_manager.h b/components/web_modal/native_web_contents_modal_dialog_manager.h index 7145a08..4df3680 100644 --- a/components/web_modal/native_web_contents_modal_dialog_manager.h +++ b/components/web_modal/native_web_contents_modal_dialog_manager.h @@ -13,6 +13,8 @@ class WebContents; namespace web_modal { +class WebContentsModalDialogHost; + // Interface from NativeWebContentsModalDialogManager to // WebContentsModalDialogManager. class NativeWebContentsModalDialogManagerDelegate { @@ -54,6 +56,9 @@ class NativeWebContentsModalDialogManager { // Runs a pulse animation for the web contents modal dialog. virtual void PulseDialog(NativeWebContentsModalDialog dialog) = 0; + // Called when the host view for the dialog has changed. + virtual void HostChanged(WebContentsModalDialogHost* new_host) = 0; + protected: NativeWebContentsModalDialogManager() {} diff --git a/components/web_modal/web_contents_modal_dialog_manager.cc b/components/web_modal/web_contents_modal_dialog_manager.cc index 0e07f8d..f30b6a0 100644 --- a/components/web_modal/web_contents_modal_dialog_manager.cc +++ b/components/web_modal/web_contents_modal_dialog_manager.cc @@ -25,6 +25,13 @@ WebContentsModalDialogManager::~WebContentsModalDialogManager() { DCHECK(child_dialogs_.empty()); } +void WebContentsModalDialogManager::SetDelegate( + WebContentsModalDialogManagerDelegate* d) { + delegate_ = d; + // Delegate can be NULL on Views/Win32 during tab drag. + native_manager_->HostChanged(d ? d->GetWebContentsModalDialogHost() : NULL); +} + void WebContentsModalDialogManager::ShowDialog( NativeWebContentsModalDialog dialog) { child_dialogs_.push_back(dialog); diff --git a/components/web_modal/web_contents_modal_dialog_manager.h b/components/web_modal/web_contents_modal_dialog_manager.h index e2548c0..09115f0 100644 --- a/components/web_modal/web_contents_modal_dialog_manager.h +++ b/components/web_modal/web_contents_modal_dialog_manager.h @@ -29,7 +29,7 @@ class WebContentsModalDialogManager virtual ~WebContentsModalDialogManager(); WebContentsModalDialogManagerDelegate* delegate() const { return delegate_; } - void set_delegate(WebContentsModalDialogManagerDelegate* d) { delegate_ = d; } + void SetDelegate(WebContentsModalDialogManagerDelegate* d); static NativeWebContentsModalDialogManager* CreateNativeManager( NativeWebContentsModalDialogManagerDelegate* native_delegate); diff --git a/components/web_modal/web_contents_modal_dialog_manager_unittest.cc b/components/web_modal/web_contents_modal_dialog_manager_unittest.cc index 1268896..da4d227 100644 --- a/components/web_modal/web_contents_modal_dialog_manager_unittest.cc +++ b/components/web_modal/web_contents_modal_dialog_manager_unittest.cc @@ -41,6 +41,8 @@ class NativeWebContentsModalDialogManagerCloseTest } virtual void PulseDialog(NativeWebContentsModalDialog dialog) OVERRIDE { } + virtual void HostChanged(WebContentsModalDialogHost* new_host) OVERRIDE { + } int close_count; NativeWebContentsModalDialogManagerDelegate* delegate_; |