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