| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/views/dom_view.h" | 5 #include "chrome/browser/ui/views/dom_view.h" |
| 6 | 6 |
| 7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
| 8 #include "chrome/browser/renderer_preferences_util.h" | 8 #include "chrome/browser/renderer_preferences_util.h" |
| 9 #include "chrome/browser/ui/views/tab_contents/tab_contents_view_views.h" | 9 #include "chrome/browser/ui/views/tab_contents/tab_contents_view_views.h" |
| 10 #include "content/browser/tab_contents/tab_contents.h" | 10 #include "content/browser/tab_contents/tab_contents.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 } | 46 } |
| 47 | 47 |
| 48 TabContents* DOMView::CreateTabContents(Profile* profile, | 48 TabContents* DOMView::CreateTabContents(Profile* profile, |
| 49 SiteInstance* instance) { | 49 SiteInstance* instance) { |
| 50 return new TabContents(profile, instance, MSG_ROUTING_NONE, NULL, NULL); | 50 return new TabContents(profile, instance, MSG_ROUTING_NONE, NULL, NULL); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void DOMView::LoadURL(const GURL& url) { | 53 void DOMView::LoadURL(const GURL& url) { |
| 54 DCHECK(initialized_); | 54 DCHECK(initialized_); |
| 55 dom_contents_->tab_contents()->controller().LoadURL( | 55 dom_contents_->tab_contents()->controller().LoadURL( |
| 56 url, GURL(), content::PAGE_TRANSITION_START_PAGE, std::string()); | 56 url, content::Referrer(), content::PAGE_TRANSITION_START_PAGE, |
| 57 std::string()); |
| 57 } | 58 } |
| 58 | 59 |
| 59 bool DOMView::SkipDefaultKeyEventProcessing(const views::KeyEvent& e) { | 60 bool DOMView::SkipDefaultKeyEventProcessing(const views::KeyEvent& e) { |
| 60 // Don't move the focus to the next view when tab is pressed, we want the | 61 // Don't move the focus to the next view when tab is pressed, we want the |
| 61 // key event to be propagated to the render view for doing the tab traversal | 62 // key event to be propagated to the render view for doing the tab traversal |
| 62 // there. | 63 // there. |
| 63 return views::FocusManager::IsTabTraversalKeyEvent(e); | 64 return views::FocusManager::IsTabTraversalKeyEvent(e); |
| 64 } | 65 } |
| 65 | 66 |
| 66 void DOMView::OnFocus() { | 67 void DOMView::OnFocus() { |
| 67 dom_contents_->tab_contents()->Focus(); | 68 dom_contents_->tab_contents()->Focus(); |
| 68 } | 69 } |
| 69 | 70 |
| 70 void DOMView::ViewHierarchyChanged(bool is_add, views::View* parent, | 71 void DOMView::ViewHierarchyChanged(bool is_add, views::View* parent, |
| 71 views::View* child) { | 72 views::View* child) { |
| 72 // Attach the native_view when this is added to Widget if | 73 // Attach the native_view when this is added to Widget if |
| 73 // the native view has not been attached yet and tab_contents_ exists. | 74 // the native view has not been attached yet and tab_contents_ exists. |
| 74 views::NativeViewHost::ViewHierarchyChanged(is_add, parent, child); | 75 views::NativeViewHost::ViewHierarchyChanged(is_add, parent, child); |
| 75 if (is_add && GetWidget() && !native_view() && dom_contents_.get()) | 76 if (is_add && GetWidget() && !native_view() && dom_contents_.get()) |
| 76 AttachTabContents(); | 77 AttachTabContents(); |
| 77 else if (!is_add && child == this && native_view()) | 78 else if (!is_add && child == this && native_view()) |
| 78 Detach(); | 79 Detach(); |
| 79 } | 80 } |
| 80 | 81 |
| 81 void DOMView::AttachTabContents() { | 82 void DOMView::AttachTabContents() { |
| 82 Attach(dom_contents_->tab_contents()->GetNativeView()); | 83 Attach(dom_contents_->tab_contents()->GetNativeView()); |
| 83 } | 84 } |
| OLD | NEW |