| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/views/dom_view.h" | 5 #include "chrome/browser/views/dom_view.h" |
| 6 | 6 |
| 7 #include "chrome/browser/dom_ui/dom_ui_host.h" | 7 #include "chrome/browser/dom_ui/dom_ui_host.h" |
| 8 | 8 |
| 9 DOMView::DOMView() : initialized_(false), web_contents_(NULL) { | 9 DOMView::DOMView() : initialized_(false), web_contents_(NULL) { |
| 10 SetFocusable(true); | 10 SetFocusable(true); |
| 11 } | 11 } |
| 12 | 12 |
| 13 DOMView::~DOMView() { | 13 DOMView::~DOMView() { |
| 14 if (web_contents_) { | 14 if (web_contents_) { |
| 15 Detach(); | 15 Detach(); |
| 16 web_contents_->Destroy(); | 16 web_contents_->Destroy(); |
| 17 web_contents_ = NULL; | 17 web_contents_ = NULL; |
| 18 } | 18 } |
| 19 } | 19 } |
| 20 | 20 |
| 21 bool DOMView::Init(Profile* profile, SiteInstance* instance) { | 21 bool DOMView::Init(Profile* profile, SiteInstance* instance) { |
| 22 if (initialized_) | 22 if (initialized_) |
| 23 return true; | 23 return true; |
| 24 | 24 |
| 25 initialized_ = true; | 25 initialized_ = true; |
| 26 web_contents_ = new WebContents(profile, instance, NULL, | 26 web_contents_ = new WebContents(profile, instance, MSG_ROUTING_NONE, NULL); |
| 27 MSG_ROUTING_NONE, NULL); | |
| 28 views::HWNDView::Attach(web_contents_->GetNativeView()); | 27 views::HWNDView::Attach(web_contents_->GetNativeView()); |
| 29 web_contents_->SetupController(profile); | 28 web_contents_->SetupController(profile); |
| 30 return true; | 29 return true; |
| 31 } | 30 } |
| 32 | 31 |
| 33 void DOMView::LoadURL(const GURL& url) { | 32 void DOMView::LoadURL(const GURL& url) { |
| 34 DCHECK(initialized_); | 33 DCHECK(initialized_); |
| 35 web_contents_->controller()->LoadURL(url, GURL(), PageTransition::START_PAGE); | 34 web_contents_->controller()->LoadURL(url, GURL(), PageTransition::START_PAGE); |
| 36 } | 35 } |
| OLD | NEW |