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