diff options
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_; |