| 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/tab_contents/tab_contents.h" | 7 #include "chrome/browser/tab_contents/tab_contents.h" |
| 8 #include "views/focus/focus_manager.h" | 8 #include "views/focus/focus_manager.h" |
| 9 | 9 |
| 10 DOMView::DOMView() : initialized_(false), tab_contents_(NULL) { | 10 DOMView::DOMView() : initialized_(false), tab_contents_(NULL) { |
| 11 SetFocusable(true); | 11 SetFocusable(true); |
| 12 } | 12 } |
| 13 | 13 |
| 14 DOMView::~DOMView() { | 14 DOMView::~DOMView() { |
| 15 if (tab_contents_.get()) | 15 if (tab_contents_.get()) |
| 16 Detach(); | 16 Detach(); |
| 17 } | 17 } |
| 18 | 18 |
| 19 bool DOMView::Init(Profile* profile, SiteInstance* instance) { | 19 bool DOMView::Init(Profile* profile, SiteInstance* instance) { |
| 20 if (initialized_) | 20 if (initialized_) |
| 21 return true; | 21 return true; |
| 22 | 22 |
| 23 initialized_ = true; | 23 initialized_ = true; |
| 24 tab_contents_.reset(new TabContents(profile, instance, | 24 tab_contents_.reset(new TabContents(profile, instance, |
| 25 MSG_ROUTING_NONE, NULL)); | 25 MSG_ROUTING_NONE, NULL)); |
| 26 views::HWNDView::Attach(tab_contents_->GetNativeView()); | 26 views::NativeViewHost::Attach(tab_contents_->GetNativeView()); |
| 27 return true; | 27 return true; |
| 28 } | 28 } |
| 29 | 29 |
| 30 void DOMView::LoadURL(const GURL& url) { | 30 void DOMView::LoadURL(const GURL& url) { |
| 31 DCHECK(initialized_); | 31 DCHECK(initialized_); |
| 32 tab_contents_->controller().LoadURL(url, GURL(), PageTransition::START_PAGE); | 32 tab_contents_->controller().LoadURL(url, GURL(), PageTransition::START_PAGE); |
| 33 } | 33 } |
| 34 | 34 |
| 35 bool DOMView::SkipDefaultKeyEventProcessing(const views::KeyEvent& e) { | 35 bool DOMView::SkipDefaultKeyEventProcessing(const views::KeyEvent& e) { |
| 36 // Don't move the focus to the next view when tab is pressed, we want the | 36 // Don't move the focus to the next view when tab is pressed, we want the |
| 37 // key event to be propagated to the render view for doing the tab traversal | 37 // key event to be propagated to the render view for doing the tab traversal |
| 38 // there. | 38 // there. |
| 39 return views::FocusManager::IsTabTraversalKeyEvent(e); | 39 return views::FocusManager::IsTabTraversalKeyEvent(e); |
| 40 } | 40 } |
| OLD | NEW |