diff options
-rw-r--r-- | chrome/browser/external_tab_container.cc | 16 | ||||
-rw-r--r-- | chrome/browser/external_tab_container.h | 12 |
2 files changed, 27 insertions, 1 deletions
diff --git a/chrome/browser/external_tab_container.cc b/chrome/browser/external_tab_container.cc index 40dff0f..ab74af1 100644 --- a/chrome/browser/external_tab_container.cc +++ b/chrome/browser/external_tab_container.cc @@ -11,7 +11,7 @@ #include "base/logging.h" #include "base/win_util.h" #include "chrome/browser/automation/automation_provider.h" -#include "chrome/browser/browser.h" +#include "chrome/browser/browser_window.h" #include "chrome/browser/load_notification_details.h" #include "chrome/browser/profile.h" #include "chrome/browser/tab_contents/provisional_load_details.h" @@ -294,6 +294,17 @@ bool ExternalTabContainer::HandleKeyboardEvent( event.os_event.lParam); } +void ExternalTabContainer::ShowHtmlDialog(HtmlDialogUIDelegate* delegate, + gfx::NativeWindow parent_window) { + if (!browser_.get()) { + browser_.reset(Browser::CreateForPopup(tab_contents_->profile())); + } + + gfx::NativeWindow parent = parent_window ? parent_window + : GetParent(); + browser_->window()->ShowHTMLDialog(delegate, parent); +} + //////////////////////////////////////////////////////////////////////////////// // ExternalTabContainer, NotificationObserver implementation: @@ -384,6 +395,9 @@ void ExternalTabContainer::Observe(NotificationType type, void ExternalTabContainer::OnDestroy() { Uninitialize(GetNativeView()); WidgetWin::OnDestroy(); + if (browser_.get()) { + ::DestroyWindow(browser_->window()->GetNativeHandle()); + } } //////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/external_tab_container.h b/chrome/browser/external_tab_container.h index 64accf5..f698c9e 100644 --- a/chrome/browser/external_tab_container.h +++ b/chrome/browser/external_tab_container.h @@ -8,6 +8,7 @@ #include <vector> #include "chrome/browser/automation/automation_resource_message_filter.h" +#include "chrome/browser/browser.h" #include "chrome/browser/tab_contents/tab_contents_delegate.h" #include "chrome/common/notification_observer.h" #include "chrome/common/notification_registrar.h" @@ -103,6 +104,14 @@ class ExternalTabContainer : public TabContentsDelegate, // parameter. virtual bool ExecuteContextMenuCommand(int command); + // Show a dialog with HTML content. |delegate| contains a pointer to the + // delegate who knows how to display the dialog (which file URL and JSON + // string input to use during initialization). |parent_window| is the window + // that should be parent of the dialog, or NULL for the default. + virtual void ShowHtmlDialog(HtmlDialogUIDelegate* delegate, + gfx::NativeWindow parent_window); + + protected: // Overridden from views::WidgetWin: virtual void OnDestroy(); @@ -145,6 +154,9 @@ class ExternalTabContainer : public TabContentsDelegate, // If all the url requests for this tab are to be loaded via automation. bool load_requests_via_automation_; + // Scoped browser object for this ExternalTabContainer instance. + scoped_ptr<Browser> browser_; + DISALLOW_COPY_AND_ASSIGN(ExternalTabContainer); }; |