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" |
11 #include "ui/views/focus/focus_manager.h" | 11 #include "ui/views/focus/focus_manager.h" |
12 #include "views/widget/native_widget_views.h" | |
13 | 12 |
14 // static | 13 // static |
15 const char DOMView::kViewClassName[] = | 14 const char DOMView::kViewClassName[] = |
16 "browser/ui/views/DOMView"; | 15 "browser/ui/views/DOMView"; |
17 | 16 |
18 DOMView::DOMView() : initialized_(false) { | 17 DOMView::DOMView() : initialized_(false) { |
19 set_focusable(true); | 18 set_focusable(true); |
20 } | 19 } |
21 | 20 |
22 DOMView::~DOMView() { | 21 DOMView::~DOMView() { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 // Attach the native_view when this is added to Widget if | 72 // Attach the native_view when this is added to Widget if |
74 // the native view has not been attached yet and tab_contents_ exists. | 73 // the native view has not been attached yet and tab_contents_ exists. |
75 views::NativeViewHost::ViewHierarchyChanged(is_add, parent, child); | 74 views::NativeViewHost::ViewHierarchyChanged(is_add, parent, child); |
76 if (is_add && GetWidget() && !native_view() && dom_contents_.get()) | 75 if (is_add && GetWidget() && !native_view() && dom_contents_.get()) |
77 AttachTabContents(); | 76 AttachTabContents(); |
78 else if (!is_add && child == this && native_view()) | 77 else if (!is_add && child == this && native_view()) |
79 Detach(); | 78 Detach(); |
80 } | 79 } |
81 | 80 |
82 void DOMView::AttachTabContents() { | 81 void DOMView::AttachTabContents() { |
83 #if !defined(USE_AURA) | 82 Attach(dom_contents_->tab_contents()->GetNativeView()); |
84 if (views::Widget::IsPureViews()) { | |
85 TabContentsViewViews* widget = static_cast<TabContentsViewViews*>( | |
86 dom_contents_->tab_contents()->view()); | |
87 views::NativeWidgetViews* nwv = | |
88 static_cast<views::NativeWidgetViews*>(widget->native_widget()); | |
89 AttachToView(nwv->GetView()); | |
90 } else { | |
91 #endif | |
92 Attach(dom_contents_->tab_contents()->GetNativeView()); | |
93 #if !defined(USE_AURA) | |
94 } | |
95 #endif | |
96 } | 83 } |
OLD | NEW |