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/dom_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/dom_view.cc')
-rw-r--r-- | chrome/browser/views/dom_view.cc | 32 |
1 files changed, 14 insertions, 18 deletions
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); +} |