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 2323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2666 // Now that the RenderView has been created, we need to tell it its size. | 2662 // Now that the RenderView has been created, we need to tell it its size. |
2667 if (rwh_view) | 2663 if (rwh_view) |
2668 rwh_view->SetSize(view_->GetContainerSize()); | 2664 rwh_view->SetSize(view_->GetContainerSize()); |
2669 | 2665 |
2670 // Make sure we use the correct starting page_id in the new RenderView. | 2666 // Make sure we use the correct starting page_id in the new RenderView. |
2671 UpdateMaxPageIDIfNecessary(render_view_host); | 2667 UpdateMaxPageIDIfNecessary(render_view_host); |
2672 int32 max_page_id = | 2668 int32 max_page_id = |
2673 GetMaxPageIDForSiteInstance(render_view_host->GetSiteInstance()); | 2669 GetMaxPageIDForSiteInstance(render_view_host->GetSiteInstance()); |
2674 | 2670 |
2675 if (!static_cast<RenderViewHostImpl*>( | 2671 if (!static_cast<RenderViewHostImpl*>( |
2676 render_view_host)->CreateRenderView(string16(), opener_route_id, | 2672 render_view_host)->CreateRenderView(string16(), |
2677 max_page_id)) { | 2673 opener_route_id, |
| 2674 max_page_id, |
| 2675 -1)) { |
2678 return false; | 2676 return false; |
2679 } | 2677 } |
2680 | 2678 |
2681 #if defined(OS_LINUX) || defined(OS_OPENBSD) | 2679 #if defined(OS_LINUX) || defined(OS_OPENBSD) |
2682 // Force a ViewMsg_Resize to be sent, needed to make plugins show up on | 2680 // Force a ViewMsg_Resize to be sent, needed to make plugins show up on |
2683 // linux. See crbug.com/83941. | 2681 // linux. See crbug.com/83941. |
2684 if (rwh_view) { | 2682 if (rwh_view) { |
2685 if (RenderWidgetHost* render_widget_host = rwh_view->GetRenderWidgetHost()) | 2683 if (RenderWidgetHost* render_widget_host = rwh_view->GetRenderWidgetHost()) |
2686 render_widget_host->WasResized(); | 2684 render_widget_host->WasResized(); |
2687 } | 2685 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2738 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 2736 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
2739 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); | 2737 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); |
2740 // Can be NULL during tests. | 2738 // Can be NULL during tests. |
2741 if (rwh_view) | 2739 if (rwh_view) |
2742 rwh_view->SetSize(GetView()->GetContainerSize()); | 2740 rwh_view->SetSize(GetView()->GetContainerSize()); |
2743 } | 2741 } |
2744 | 2742 |
2745 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() { | 2743 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() { |
2746 return static_cast<RenderViewHostImpl*>(GetRenderViewHost()); | 2744 return static_cast<RenderViewHostImpl*>(GetRenderViewHost()); |
2747 } | 2745 } |
OLD | NEW |