diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-03 03:05:11 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-03 03:05:11 +0000 |
commit | 4acc19a6f31abef9608546d10f107240603ca57e (patch) | |
tree | 632c914c428e94c05c8b9cb52cb183e62ae13e56 /chrome/browser/views/html_dialog_view.cc | |
parent | 15936cdb983239ba2347e624af19e7305e416c7b (diff) | |
download | chromium_src-4acc19a6f31abef9608546d10f107240603ca57e.zip chromium_src-4acc19a6f31abef9608546d10f107240603ca57e.tar.gz chromium_src-4acc19a6f31abef9608546d10f107240603ca57e.tar.bz2 |
Move HTML dialogs out of their own tab contents type. Moved functions to new
file html_dialog_ui.*
Move WebContents view creation into the constructor, which makes a bunch of
extra calls to CreateView unnecessary.
Remove unused CallJavascriptFunction() functions in DOMUI.
Review URL: http://codereview.chromium.org/56065
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13065 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/html_dialog_view.cc')
-rw-r--r-- | chrome/browser/views/html_dialog_view.cc | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/chrome/browser/views/html_dialog_view.cc b/chrome/browser/views/html_dialog_view.cc index c26bdaf..ecb459c 100644 --- a/chrome/browser/views/html_dialog_view.cc +++ b/chrome/browser/views/html_dialog_view.cc @@ -5,6 +5,7 @@ #include "chrome/browser/views/html_dialog_view.h" #include "chrome/browser/browser.h" +#include "chrome/browser/tab_contents/web_contents.h" #include "chrome/views/widget/root_view.h" #include "chrome/views/window/window.h" @@ -13,8 +14,8 @@ HtmlDialogView::HtmlDialogView(Browser* parent_browser, Profile* profile, - HtmlDialogContentsDelegate* delegate) - : DOMView(delegate->GetDialogContentURL()), + HtmlDialogUIDelegate* delegate) + : DOMView(), parent_browser_(parent_browser), profile_(profile), delegate_(delegate) { @@ -66,7 +67,7 @@ views::View* HtmlDialogView::GetInitiallyFocusedView() { } //////////////////////////////////////////////////////////////////////////////// -// HtmlDialogContentsDelegate implementation: +// HtmlDialogUIDelegate implementation: bool HtmlDialogView::IsDialogModal() const { return IsModal(); @@ -122,10 +123,10 @@ void HtmlDialogView::ReplaceContents(TabContents* source, } void HtmlDialogView::AddNewContents(TabContents* source, - TabContents* new_contents, - WindowOpenDisposition disposition, - const gfx::Rect& initial_pos, - bool user_gesture) { + TabContents* new_contents, + WindowOpenDisposition disposition, + const gfx::Rect& initial_pos, + bool user_gesture) { parent_browser_->AddNewContents( source, new_contents, NEW_WINDOW, initial_pos, user_gesture); } @@ -177,9 +178,10 @@ void HtmlDialogView::InitDialog() { // Now Init the DOMView. This view runs in its own process to render the html. DOMView::Init(profile_, NULL); - // Make sure this new TabContents we just created in Init() knows about us. - DCHECK(host_->type() == TAB_CONTENTS_HTML_DIALOG); - HtmlDialogContents* host = static_cast<HtmlDialogContents*>(host_); - host->Init(this); - host->set_delegate(this); + // Set the delegate. This must be done before loading the page. See + // the comment above HtmlDialogUI in its header file for why. + HtmlDialogUI::GetPropertyAccessor().SetProperty(web_contents_->property_bag(), + this); + + DOMView::LoadURL(delegate_->GetDialogContentURL()); } |