From 4acc19a6f31abef9608546d10f107240603ca57e Mon Sep 17 00:00:00 2001 From: "brettw@chromium.org" Date: Fri, 3 Apr 2009 03:05:11 +0000 Subject: 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 --- chrome/browser/views/dom_view.cc | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) (limited to 'chrome/browser/views/dom_view.cc') diff --git a/chrome/browser/views/dom_view.cc b/chrome/browser/views/dom_view.cc index bd7f7df..9af3b66 100644 --- a/chrome/browser/views/dom_view.cc +++ b/chrome/browser/views/dom_view.cc @@ -6,35 +6,31 @@ #include "chrome/browser/dom_ui/dom_ui_host.h" -DOMView::DOMView(const GURL& contents) - : contents_(contents), initialized_(false), host_(NULL) { +DOMView::DOMView() : initialized_(false), web_contents_(NULL) { SetFocusable(true); } DOMView::~DOMView() { - if (host_) { + if (web_contents_) { Detach(); - host_->Destroy(); - host_ = NULL; + web_contents_->Destroy(); + web_contents_ = NULL; } } bool DOMView::Init(Profile* profile, SiteInstance* instance) { if (initialized_) return true; - initialized_ = true; - - // TODO(timsteele): This should use a separate factory method; e.g - // a DOMUIHostFactory rather than TabContentsFactory, because DOMView's - // should only be associated with instances of DOMUIHost. - TabContentsType type = TabContents::TypeForURL(&contents_); - TabContents* tab_contents = TabContents::CreateWithType(type, profile, - instance); - host_ = tab_contents->AsDOMUIHost(); - DCHECK(host_); - views::HWNDView::Attach(host_->GetNativeView()); - host_->SetupController(profile); - host_->controller()->LoadURL(contents_, GURL(), PageTransition::START_PAGE); + initialized_ = true; + web_contents_ = new WebContents(profile, instance, NULL, + MSG_ROUTING_NONE, NULL); + views::HWNDView::Attach(web_contents_->GetNativeView()); + web_contents_->SetupController(profile); return true; } + +void DOMView::LoadURL(const GURL& url) { + DCHECK(initialized_); + web_contents_->controller()->LoadURL(url, GURL(), PageTransition::START_PAGE); +} -- cgit v1.1