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_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
11 #include "base/metrics/stats_counters.h" | 11 #include "base/metrics/stats_counters.h" |
12 #include "base/string16.h" | 12 #include "base/string16.h" |
13 #include "base/string_number_conversions.h" | 13 #include "base/string_number_conversions.h" |
14 #include "base/string_util.h" | 14 #include "base/string_util.h" |
15 #include "base/time.h" | 15 #include "base/time.h" |
16 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
17 #include "content/browser/browser_plugin/browser_plugin_web_contents_observer.h" | |
18 #include "content/browser/child_process_security_policy_impl.h" | 17 #include "content/browser/child_process_security_policy_impl.h" |
19 #include "content/browser/debugger/devtools_manager_impl.h" | 18 #include "content/browser/debugger/devtools_manager_impl.h" |
20 #include "content/browser/dom_storage/session_storage_namespace_impl.h" | 19 #include "content/browser/dom_storage/session_storage_namespace_impl.h" |
21 #include "content/browser/download/download_stats.h" | 20 #include "content/browser/download/download_stats.h" |
22 #include "content/browser/download/mhtml_generation_manager.h" | 21 #include "content/browser/download/mhtml_generation_manager.h" |
23 #include "content/browser/download/save_package.h" | 22 #include "content/browser/download/save_package.h" |
24 #include "content/browser/gpu/gpu_data_manager_impl.h" | 23 #include "content/browser/gpu/gpu_data_manager_impl.h" |
25 #include "content/browser/gpu/gpu_process_host.h" | 24 #include "content/browser/gpu/gpu_process_host.h" |
26 #include "content/browser/host_zoom_map_impl.h" | 25 #include "content/browser/host_zoom_map_impl.h" |
27 #include "content/browser/intents/web_intents_dispatcher_impl.h" | 26 #include "content/browser/intents/web_intents_dispatcher_impl.h" |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 // Listen for whether our opener gets destroyed. | 319 // Listen for whether our opener gets destroyed. |
321 if (opener_) { | 320 if (opener_) { |
322 registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED, | 321 registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED, |
323 content::Source<WebContents>(opener_)); | 322 content::Source<WebContents>(opener_)); |
324 } | 323 } |
325 | 324 |
326 #if defined(ENABLE_JAVA_BRIDGE) | 325 #if defined(ENABLE_JAVA_BRIDGE) |
327 java_bridge_dispatcher_host_manager_.reset( | 326 java_bridge_dispatcher_host_manager_.reset( |
328 new JavaBridgeDispatcherHostManager(this)); | 327 new JavaBridgeDispatcherHostManager(this)); |
329 #endif | 328 #endif |
330 | |
331 browser_plugin_web_contents_observer_.reset( | |
332 new content::BrowserPluginWebContentsObserver(this)); | |
333 } | 329 } |
334 | 330 |
335 WebContentsImpl::~WebContentsImpl() { | 331 WebContentsImpl::~WebContentsImpl() { |
336 is_being_destroyed_ = true; | 332 is_being_destroyed_ = true; |
337 | 333 |
338 // Clear out any JavaScript state. | 334 // Clear out any JavaScript state. |
339 if (dialog_creator_) | 335 if (dialog_creator_) |
340 dialog_creator_->ResetJavaScriptState(this); | 336 dialog_creator_->ResetJavaScriptState(this); |
341 | 337 |
342 if (color_chooser_) | 338 if (color_chooser_) |
(...skipping 2363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2706 // Now that the RenderView has been created, we need to tell it its size. | 2702 // Now that the RenderView has been created, we need to tell it its size. |
2707 if (rwh_view) | 2703 if (rwh_view) |
2708 rwh_view->SetSize(view_->GetContainerSize()); | 2704 rwh_view->SetSize(view_->GetContainerSize()); |
2709 | 2705 |
2710 // Make sure we use the correct starting page_id in the new RenderView. | 2706 // Make sure we use the correct starting page_id in the new RenderView. |
2711 UpdateMaxPageIDIfNecessary(render_view_host); | 2707 UpdateMaxPageIDIfNecessary(render_view_host); |
2712 int32 max_page_id = | 2708 int32 max_page_id = |
2713 GetMaxPageIDForSiteInstance(render_view_host->GetSiteInstance()); | 2709 GetMaxPageIDForSiteInstance(render_view_host->GetSiteInstance()); |
2714 | 2710 |
2715 if (!static_cast<RenderViewHostImpl*>( | 2711 if (!static_cast<RenderViewHostImpl*>( |
2716 render_view_host)->CreateRenderView(string16(), opener_route_id, | 2712 render_view_host)->CreateRenderView(string16(), |
2717 max_page_id)) { | 2713 opener_route_id, |
| 2714 max_page_id, |
| 2715 -1)) { |
2718 return false; | 2716 return false; |
2719 } | 2717 } |
2720 | 2718 |
2721 #if defined(OS_LINUX) || defined(OS_OPENBSD) | 2719 #if defined(OS_LINUX) || defined(OS_OPENBSD) |
2722 // Force a ViewMsg_Resize to be sent, needed to make plugins show up on | 2720 // Force a ViewMsg_Resize to be sent, needed to make plugins show up on |
2723 // linux. See crbug.com/83941. | 2721 // linux. See crbug.com/83941. |
2724 if (rwh_view) { | 2722 if (rwh_view) { |
2725 if (RenderWidgetHost* render_widget_host = rwh_view->GetRenderWidgetHost()) | 2723 if (RenderWidgetHost* render_widget_host = rwh_view->GetRenderWidgetHost()) |
2726 render_widget_host->WasResized(); | 2724 render_widget_host->WasResized(); |
2727 } | 2725 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2778 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 2776 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
2779 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); | 2777 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); |
2780 // Can be NULL during tests. | 2778 // Can be NULL during tests. |
2781 if (rwh_view) | 2779 if (rwh_view) |
2782 rwh_view->SetSize(GetView()->GetContainerSize()); | 2780 rwh_view->SetSize(GetView()->GetContainerSize()); |
2783 } | 2781 } |
2784 | 2782 |
2785 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() { | 2783 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() { |
2786 return static_cast<RenderViewHostImpl*>(GetRenderViewHost()); | 2784 return static_cast<RenderViewHostImpl*>(GetRenderViewHost()); |
2787 } | 2785 } |
OLD | NEW |