OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/web_contents/web_contents_view_aura.h" | 5 #include "content/browser/web_contents/web_contents_view_aura.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1106 window_observer_.reset(new WindowObserver(this)); | 1106 window_observer_.reset(new WindowObserver(this)); |
1107 | 1107 |
1108 // delegate_->GetDragDestDelegate() creates a new delegate on every call. | 1108 // delegate_->GetDragDestDelegate() creates a new delegate on every call. |
1109 // Hence, we save a reference to it locally. Similar model is used on other | 1109 // Hence, we save a reference to it locally. Similar model is used on other |
1110 // platforms as well. | 1110 // platforms as well. |
1111 if (delegate_) | 1111 if (delegate_) |
1112 drag_dest_delegate_ = delegate_->GetDragDestDelegate(); | 1112 drag_dest_delegate_ = delegate_->GetDragDestDelegate(); |
1113 } | 1113 } |
1114 | 1114 |
1115 RenderWidgetHostViewBase* WebContentsViewAura::CreateViewForWidget( | 1115 RenderWidgetHostViewBase* WebContentsViewAura::CreateViewForWidget( |
1116 RenderWidgetHost* render_widget_host) { | 1116 RenderWidgetHost* render_widget_host, bool is_guest_view_hack) { |
1117 if (render_widget_host->GetView()) { | 1117 if (render_widget_host->GetView()) { |
1118 // During testing, the view will already be set up in most cases to the | 1118 // During testing, the view will already be set up in most cases to the |
1119 // test view, so we don't want to clobber it with a real one. To verify that | 1119 // test view, so we don't want to clobber it with a real one. To verify that |
1120 // this actually is happening (and somebody isn't accidentally creating the | 1120 // this actually is happening (and somebody isn't accidentally creating the |
1121 // view twice), we check for the RVH Factory, which will be set when we're | 1121 // view twice), we check for the RVH Factory, which will be set when we're |
1122 // making special ones (which go along with the special views). | 1122 // making special ones (which go along with the special views). |
1123 DCHECK(RenderViewHostFactory::has_factory()); | 1123 DCHECK(RenderViewHostFactory::has_factory()); |
1124 return static_cast<RenderWidgetHostViewBase*>( | 1124 return static_cast<RenderWidgetHostViewBase*>( |
1125 render_widget_host->GetView()); | 1125 render_widget_host->GetView()); |
1126 } | 1126 } |
1127 | 1127 |
1128 RenderWidgetHostViewAura* view = | 1128 RenderWidgetHostViewAura* view = |
1129 new RenderWidgetHostViewAura(render_widget_host); | 1129 new RenderWidgetHostViewAura(render_widget_host, is_guest_view_hack); |
1130 view->InitAsChild(NULL); | 1130 view->InitAsChild(NULL); |
1131 GetNativeView()->AddChild(view->GetNativeView()); | 1131 GetNativeView()->AddChild(view->GetNativeView()); |
1132 | 1132 |
1133 if (navigation_overlay_.get() && navigation_overlay_->has_window()) { | 1133 if (navigation_overlay_.get() && navigation_overlay_->has_window()) { |
1134 navigation_overlay_->StartObserving(); | 1134 navigation_overlay_->StartObserving(); |
1135 } | 1135 } |
1136 | 1136 |
1137 RenderWidgetHostImpl* host_impl = | 1137 RenderWidgetHostImpl* host_impl = |
1138 RenderWidgetHostImpl::From(render_widget_host); | 1138 RenderWidgetHostImpl::From(render_widget_host); |
1139 | 1139 |
1140 if (!host_impl->is_hidden()) | 1140 if (!host_impl->is_hidden()) |
1141 view->Show(); | 1141 view->Show(); |
1142 | 1142 |
1143 // We listen to drag drop events in the newly created view's window. | 1143 // We listen to drag drop events in the newly created view's window. |
1144 aura::client::SetDragDropDelegate(view->GetNativeView(), this); | 1144 aura::client::SetDragDropDelegate(view->GetNativeView(), this); |
1145 | 1145 |
1146 if (view->overscroll_controller() && | 1146 if (view->overscroll_controller() && |
1147 (!web_contents_->GetDelegate() || | 1147 (!web_contents_->GetDelegate() || |
1148 web_contents_->GetDelegate()->CanOverscrollContent())) { | 1148 web_contents_->GetDelegate()->CanOverscrollContent())) { |
1149 InstallOverscrollControllerDelegate(view); | 1149 InstallOverscrollControllerDelegate(view); |
1150 } | 1150 } |
1151 | 1151 |
1152 AttachTouchEditableToRenderView(); | 1152 AttachTouchEditableToRenderView(); |
1153 return view; | 1153 return view; |
1154 } | 1154 } |
1155 | 1155 |
1156 RenderWidgetHostViewBase* WebContentsViewAura::CreateViewForPopupWidget( | 1156 RenderWidgetHostViewBase* WebContentsViewAura::CreateViewForPopupWidget( |
1157 RenderWidgetHost* render_widget_host) { | 1157 RenderWidgetHost* render_widget_host, bool is_guest_view_hack) { |
1158 return new RenderWidgetHostViewAura(render_widget_host); | 1158 return new RenderWidgetHostViewAura(render_widget_host, is_guest_view_hack); |
1159 } | 1159 } |
1160 | 1160 |
1161 void WebContentsViewAura::SetPageTitle(const base::string16& title) { | 1161 void WebContentsViewAura::SetPageTitle(const base::string16& title) { |
1162 window_->SetTitle(title); | 1162 window_->SetTitle(title); |
1163 } | 1163 } |
1164 | 1164 |
1165 void WebContentsViewAura::RenderViewCreated(RenderViewHost* host) { | 1165 void WebContentsViewAura::RenderViewCreated(RenderViewHost* host) { |
1166 } | 1166 } |
1167 | 1167 |
1168 void WebContentsViewAura::RenderViewSwappedIn(RenderViewHost* host) { | 1168 void WebContentsViewAura::RenderViewSwappedIn(RenderViewHost* host) { |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1631 if (visible) { | 1631 if (visible) { |
1632 if (!web_contents_->should_normally_be_visible()) | 1632 if (!web_contents_->should_normally_be_visible()) |
1633 web_contents_->WasShown(); | 1633 web_contents_->WasShown(); |
1634 } else { | 1634 } else { |
1635 if (web_contents_->should_normally_be_visible()) | 1635 if (web_contents_->should_normally_be_visible()) |
1636 web_contents_->WasHidden(); | 1636 web_contents_->WasHidden(); |
1637 } | 1637 } |
1638 } | 1638 } |
1639 | 1639 |
1640 } // namespace content | 1640 } // namespace content |
OLD | NEW |