Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 9609008: Implemented Browser Plugin (NOT FOR REVIEW) (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Updated according to creis@'s comments Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_host.h"
17 #include "content/browser/child_process_security_policy_impl.h" 18 #include "content/browser/child_process_security_policy_impl.h"
18 #include "content/browser/debugger/devtools_manager_impl.h" 19 #include "content/browser/debugger/devtools_manager_impl.h"
19 #include "content/browser/dom_storage/session_storage_namespace_impl.h" 20 #include "content/browser/dom_storage/session_storage_namespace_impl.h"
20 #include "content/browser/download/download_stats.h" 21 #include "content/browser/download/download_stats.h"
21 #include "content/browser/download/mhtml_generation_manager.h" 22 #include "content/browser/download/mhtml_generation_manager.h"
22 #include "content/browser/download/save_package.h" 23 #include "content/browser/download/save_package.h"
23 #include "content/browser/gpu/gpu_data_manager_impl.h" 24 #include "content/browser/gpu/gpu_data_manager_impl.h"
24 #include "content/browser/gpu/gpu_process_host.h" 25 #include "content/browser/gpu/gpu_process_host.h"
25 #include "content/browser/host_zoom_map_impl.h" 26 #include "content/browser/host_zoom_map_impl.h"
26 #include "content/browser/intents/web_intents_dispatcher_impl.h" 27 #include "content/browser/intents/web_intents_dispatcher_impl.h"
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 // Listen for whether our opener gets destroyed. 320 // Listen for whether our opener gets destroyed.
320 if (opener_) { 321 if (opener_) {
321 registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED, 322 registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
322 content::Source<WebContents>(opener_)); 323 content::Source<WebContents>(opener_));
323 } 324 }
324 325
325 #if defined(ENABLE_JAVA_BRIDGE) 326 #if defined(ENABLE_JAVA_BRIDGE)
326 java_bridge_dispatcher_host_manager_.reset( 327 java_bridge_dispatcher_host_manager_.reset(
327 new JavaBridgeDispatcherHostManager(this)); 328 new JavaBridgeDispatcherHostManager(this));
328 #endif 329 #endif
330
331 browser_plugin_host_.reset(new content::BrowserPluginHost(this));
329 } 332 }
330 333
331 WebContentsImpl::~WebContentsImpl() { 334 WebContentsImpl::~WebContentsImpl() {
332 is_being_destroyed_ = true; 335 is_being_destroyed_ = true;
333 336
334 // Clear out any JavaScript state. 337 // Clear out any JavaScript state.
335 if (dialog_creator_) 338 if (dialog_creator_)
336 dialog_creator_->ResetJavaScriptState(this); 339 dialog_creator_->ResetJavaScriptState(this);
337 340
338 if (color_chooser_) 341 if (color_chooser_)
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 667
665 content::RenderProcessHost* WebContentsImpl::GetRenderProcessHost() const { 668 content::RenderProcessHost* WebContentsImpl::GetRenderProcessHost() const {
666 RenderViewHostImpl* host = render_manager_.current_host(); 669 RenderViewHostImpl* host = render_manager_.current_host();
667 return host ? host->GetProcess() : NULL; 670 return host ? host->GetProcess() : NULL;
668 } 671 }
669 672
670 RenderViewHost* WebContentsImpl::GetRenderViewHost() const { 673 RenderViewHost* WebContentsImpl::GetRenderViewHost() const {
671 return render_manager_.current_host(); 674 return render_manager_.current_host();
672 } 675 }
673 676
677 RenderViewHost* WebContentsImpl::GetPendingRenderViewHost() const {
678 return render_manager_.pending_render_view_host();
679 }
680
674 RenderWidgetHostView* WebContentsImpl::GetRenderWidgetHostView() const { 681 RenderWidgetHostView* WebContentsImpl::GetRenderWidgetHostView() const {
675 return render_manager_.GetRenderWidgetHostView(); 682 return render_manager_.GetRenderWidgetHostView();
676 } 683 }
677 684
678 content::WebContentsView* WebContentsImpl::GetView() const { 685 content::WebContentsView* WebContentsImpl::GetView() const {
679 return view_.get(); 686 return view_.get();
680 } 687 }
681 688
682 content::WebUI* WebContentsImpl::CreateWebUI(const GURL& url) { 689 content::WebUI* WebContentsImpl::CreateWebUI(const GURL& url) {
683 WebUIControllerFactory* factory = 690 WebUIControllerFactory* factory =
(...skipping 2022 matching lines...) Expand 10 before | Expand all | Expand 10 after
2706 2713
2707 // Now that the RenderView has been created, we need to tell it its size. 2714 // Now that the RenderView has been created, we need to tell it its size.
2708 if (rwh_view) 2715 if (rwh_view)
2709 rwh_view->SetSize(view_->GetContainerSize()); 2716 rwh_view->SetSize(view_->GetContainerSize());
2710 2717
2711 // Make sure we use the correct starting page_id in the new RenderView. 2718 // Make sure we use the correct starting page_id in the new RenderView.
2712 UpdateMaxPageIDIfNecessary(render_view_host); 2719 UpdateMaxPageIDIfNecessary(render_view_host);
2713 int32 max_page_id = 2720 int32 max_page_id =
2714 GetMaxPageIDForSiteInstance(render_view_host->GetSiteInstance()); 2721 GetMaxPageIDForSiteInstance(render_view_host->GetSiteInstance());
2715 2722
2723 WebContentsImpl* embedder = browser_plugin_host()->embedder();
2724 int embedder_process_id =
2725 embedder ? embedder->GetRenderProcessHost()->GetID() : -1;
2716 if (!static_cast<RenderViewHostImpl*>( 2726 if (!static_cast<RenderViewHostImpl*>(
2717 render_view_host)->CreateRenderView(string16(), 2727 render_view_host)->CreateRenderView(string16(),
2718 opener_route_id, 2728 opener_route_id,
2719 max_page_id, 2729 max_page_id,
2720 -1)) { 2730 embedder_process_id)) {
2721 return false; 2731 return false;
2722 } 2732 }
2723 2733
2724 #if defined(OS_LINUX) || defined(OS_OPENBSD) 2734 #if defined(OS_LINUX) || defined(OS_OPENBSD)
2725 // Force a ViewMsg_Resize to be sent, needed to make plugins show up on 2735 // Force a ViewMsg_Resize to be sent, needed to make plugins show up on
2726 // linux. See crbug.com/83941. 2736 // linux. See crbug.com/83941.
2727 if (rwh_view) { 2737 if (rwh_view) {
2728 if (RenderWidgetHost* render_widget_host = rwh_view->GetRenderWidgetHost()) 2738 if (RenderWidgetHost* render_widget_host = rwh_view->GetRenderWidgetHost())
2729 render_widget_host->WasResized(); 2739 render_widget_host->WasResized();
2730 } 2740 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
2782 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { 2792 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) {
2783 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); 2793 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh);
2784 // Can be NULL during tests. 2794 // Can be NULL during tests.
2785 if (rwh_view) 2795 if (rwh_view)
2786 rwh_view->SetSize(GetView()->GetContainerSize()); 2796 rwh_view->SetSize(GetView()->GetContainerSize());
2787 } 2797 }
2788 2798
2789 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() { 2799 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() {
2790 return static_cast<RenderViewHostImpl*>(GetRenderViewHost()); 2800 return static_cast<RenderViewHostImpl*>(GetRenderViewHost());
2791 } 2801 }
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | content/common/browser_plugin_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698