| 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" |
| (...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 IPC_MESSAGE_HANDLER(ViewHostMsg_CrashedPlugin, OnCrashedPlugin) | 733 IPC_MESSAGE_HANDLER(ViewHostMsg_CrashedPlugin, OnCrashedPlugin) |
| 734 IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed) | 734 IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed) |
| 735 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenColorChooser, OnOpenColorChooser) | 735 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenColorChooser, OnOpenColorChooser) |
| 736 IPC_MESSAGE_HANDLER(ViewHostMsg_EndColorChooser, OnEndColorChooser) | 736 IPC_MESSAGE_HANDLER(ViewHostMsg_EndColorChooser, OnEndColorChooser) |
| 737 IPC_MESSAGE_HANDLER(ViewHostMsg_SetSelectedColorInColorChooser, | 737 IPC_MESSAGE_HANDLER(ViewHostMsg_SetSelectedColorInColorChooser, |
| 738 OnSetSelectedColorInColorChooser) | 738 OnSetSelectedColorInColorChooser) |
| 739 IPC_MESSAGE_HANDLER(ViewHostMsg_PepperPluginHung, OnPepperPluginHung) | 739 IPC_MESSAGE_HANDLER(ViewHostMsg_PepperPluginHung, OnPepperPluginHung) |
| 740 IPC_MESSAGE_HANDLER(ViewHostMsg_WebUISend, OnWebUISend) | 740 IPC_MESSAGE_HANDLER(ViewHostMsg_WebUISend, OnWebUISend) |
| 741 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestPpapiBrokerPermission, | 741 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestPpapiBrokerPermission, |
| 742 OnRequestPpapiBrokerPermission) | 742 OnRequestPpapiBrokerPermission) |
| 743 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_NavigateGuest, | 743 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_CreateGuest, |
| 744 OnBrowserPluginNavigateGuest) | 744 OnBrowserPluginCreateGuest) |
| 745 IPC_MESSAGE_UNHANDLED(handled = false) | 745 IPC_MESSAGE_UNHANDLED(handled = false) |
| 746 IPC_END_MESSAGE_MAP_EX() | 746 IPC_END_MESSAGE_MAP_EX() |
| 747 message_source_ = NULL; | 747 message_source_ = NULL; |
| 748 | 748 |
| 749 if (!message_is_ok) { | 749 if (!message_is_ok) { |
| 750 content::RecordAction(UserMetricsAction("BadMessageTerminate_RVD")); | 750 content::RecordAction(UserMetricsAction("BadMessageTerminate_RVD")); |
| 751 GetRenderProcessHost()->ReceivedBadMessage(); | 751 GetRenderProcessHost()->ReceivedBadMessage(); |
| 752 } | 752 } |
| 753 | 753 |
| 754 return handled; | 754 return handled; |
| (...skipping 1606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2361 } | 2361 } |
| 2362 | 2362 |
| 2363 void WebContentsImpl::OnPpapiBrokerPermissionResult(int request_id, | 2363 void WebContentsImpl::OnPpapiBrokerPermissionResult(int request_id, |
| 2364 bool result) { | 2364 bool result) { |
| 2365 RenderViewHostImpl* rvh = GetRenderViewHostImpl(); | 2365 RenderViewHostImpl* rvh = GetRenderViewHostImpl(); |
| 2366 rvh->Send(new ViewMsg_PpapiBrokerPermissionResult(rvh->GetRoutingID(), | 2366 rvh->Send(new ViewMsg_PpapiBrokerPermissionResult(rvh->GetRoutingID(), |
| 2367 request_id, | 2367 request_id, |
| 2368 result)); | 2368 result)); |
| 2369 } | 2369 } |
| 2370 | 2370 |
| 2371 void WebContentsImpl::OnBrowserPluginCreateGuest( |
| 2372 int instance_id, |
| 2373 const std::string& storage_partition_id, |
| 2374 bool persist_storage) { |
| 2375 // This creates a BrowserPluginEmbedder, which handles all the BrowserPlugin |
| 2376 // specific messages for this WebContents (through its |
| 2377 // BrowserPluginEmbedderHelper). This means that any message from browser |
| 2378 // plugin renderer prior to CreateGuest will be ignored. |
| 2379 // For more info, see comment above classes BrowserPluginEmbedder and |
| 2380 // BrowserPluginGuest. |
| 2381 CHECK(!browser_plugin_embedder_.get()); |
| 2382 |
| 2383 browser_plugin_embedder_.reset( |
| 2384 content::BrowserPluginEmbedder::Create(this, GetRenderViewHost())); |
| 2385 browser_plugin_embedder_->CreateGuest(GetRenderViewHost(), |
| 2386 instance_id, |
| 2387 storage_partition_id, |
| 2388 persist_storage); |
| 2389 } |
| 2390 |
| 2371 void WebContentsImpl::OnBrowserPluginNavigateGuest( | 2391 void WebContentsImpl::OnBrowserPluginNavigateGuest( |
| 2372 int instance_id, | 2392 int instance_id, |
| 2373 const std::string& src, | 2393 const std::string& src, |
| 2374 const BrowserPluginHostMsg_ResizeGuest_Params& resize_params) { | 2394 const BrowserPluginHostMsg_ResizeGuest_Params& resize_params) { |
| 2375 // This is the first 'navigate' to a browser plugin, before WebContents has/is | |
| 2376 // an 'Embedder'; subsequent navigate messages for this WebContents will | |
| 2377 // be handled by the BrowserPluginEmbedderHelper of the embedder itself (this | |
| 2378 // also means any message from browser plugin renderer prior to NavigateGuest | |
| 2379 // which is not NavigateGuest will be ignored). Therefore | |
| 2380 // |browser_plugin_embedder_| should not be set. | |
| 2381 // For more info, see comment above classes BrowserPluginEmbedder and | |
| 2382 // BrowserPluginGuest. | |
| 2383 CHECK(!browser_plugin_embedder_.get()); | |
| 2384 | |
| 2385 browser_plugin_embedder_.reset( | |
| 2386 content::BrowserPluginEmbedder::Create(this, GetRenderViewHost())); | |
| 2387 browser_plugin_embedder_->NavigateGuest(GetRenderViewHost(), | 2395 browser_plugin_embedder_->NavigateGuest(GetRenderViewHost(), |
| 2388 instance_id, | 2396 instance_id, |
| 2389 src, | 2397 src, |
| 2390 resize_params); | 2398 resize_params); |
| 2391 } | 2399 } |
| 2392 | 2400 |
| 2393 // Notifies the RenderWidgetHost instance about the fact that the page is | 2401 // Notifies the RenderWidgetHost instance about the fact that the page is |
| 2394 // loading, or done loading and calls the base implementation. | 2402 // loading, or done loading and calls the base implementation. |
| 2395 void WebContentsImpl::SetIsLoading(bool is_loading, | 2403 void WebContentsImpl::SetIsLoading(bool is_loading, |
| 2396 LoadNotificationDetails* details) { | 2404 LoadNotificationDetails* details) { |
| (...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3382 } | 3390 } |
| 3383 } | 3391 } |
| 3384 | 3392 |
| 3385 content::BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() { | 3393 content::BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() { |
| 3386 return browser_plugin_guest_.get(); | 3394 return browser_plugin_guest_.get(); |
| 3387 } | 3395 } |
| 3388 | 3396 |
| 3389 content::BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() { | 3397 content::BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() { |
| 3390 return browser_plugin_embedder_.get(); | 3398 return browser_plugin_embedder_.get(); |
| 3391 } | 3399 } |
| OLD | NEW |