| 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 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 734 IPC_MESSAGE_HANDLER(ViewHostMsg_CrashedPlugin, OnCrashedPlugin) | 734 IPC_MESSAGE_HANDLER(ViewHostMsg_CrashedPlugin, OnCrashedPlugin) |
| 735 IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed) | 735 IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed) |
| 736 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenColorChooser, OnOpenColorChooser) | 736 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenColorChooser, OnOpenColorChooser) |
| 737 IPC_MESSAGE_HANDLER(ViewHostMsg_EndColorChooser, OnEndColorChooser) | 737 IPC_MESSAGE_HANDLER(ViewHostMsg_EndColorChooser, OnEndColorChooser) |
| 738 IPC_MESSAGE_HANDLER(ViewHostMsg_SetSelectedColorInColorChooser, | 738 IPC_MESSAGE_HANDLER(ViewHostMsg_SetSelectedColorInColorChooser, |
| 739 OnSetSelectedColorInColorChooser) | 739 OnSetSelectedColorInColorChooser) |
| 740 IPC_MESSAGE_HANDLER(ViewHostMsg_PepperPluginHung, OnPepperPluginHung) | 740 IPC_MESSAGE_HANDLER(ViewHostMsg_PepperPluginHung, OnPepperPluginHung) |
| 741 IPC_MESSAGE_HANDLER(ViewHostMsg_WebUISend, OnWebUISend) | 741 IPC_MESSAGE_HANDLER(ViewHostMsg_WebUISend, OnWebUISend) |
| 742 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestPpapiBrokerPermission, | 742 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestPpapiBrokerPermission, |
| 743 OnRequestPpapiBrokerPermission) | 743 OnRequestPpapiBrokerPermission) |
| 744 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_CreateGuest, | 744 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_AllocateInstanceID, |
| 745 OnBrowserPluginCreateGuest) | 745 OnBrowserPluginAllocateInstanceID) |
| 746 IPC_MESSAGE_HANDLER(IconHostMsg_DidDownloadFavicon, OnDidDownloadFavicon) | 746 IPC_MESSAGE_HANDLER(IconHostMsg_DidDownloadFavicon, OnDidDownloadFavicon) |
| 747 IPC_MESSAGE_HANDLER(IconHostMsg_UpdateFaviconURL, OnUpdateFaviconURL) | 747 IPC_MESSAGE_HANDLER(IconHostMsg_UpdateFaviconURL, OnUpdateFaviconURL) |
| 748 #if defined(OS_ANDROID) | 748 #if defined(OS_ANDROID) |
| 749 IPC_MESSAGE_HANDLER(ViewHostMsg_FindMatchRects_Reply, | 749 IPC_MESSAGE_HANDLER(ViewHostMsg_FindMatchRects_Reply, |
| 750 OnFindMatchRectsReply) | 750 OnFindMatchRectsReply) |
| 751 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenDateTimeDialog, | 751 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenDateTimeDialog, |
| 752 OnOpenDateTimeDialog) | 752 OnOpenDateTimeDialog) |
| 753 #endif | 753 #endif |
| 754 IPC_MESSAGE_UNHANDLED(handled = false) | 754 IPC_MESSAGE_UNHANDLED(handled = false) |
| 755 IPC_END_MESSAGE_MAP_EX() | 755 IPC_END_MESSAGE_MAP_EX() |
| (...skipping 1604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2360 } | 2360 } |
| 2361 | 2361 |
| 2362 void WebContentsImpl::OnPpapiBrokerPermissionResult(int request_id, | 2362 void WebContentsImpl::OnPpapiBrokerPermissionResult(int request_id, |
| 2363 bool result) { | 2363 bool result) { |
| 2364 RenderViewHostImpl* rvh = GetRenderViewHostImpl(); | 2364 RenderViewHostImpl* rvh = GetRenderViewHostImpl(); |
| 2365 rvh->Send(new ViewMsg_PpapiBrokerPermissionResult(rvh->GetRoutingID(), | 2365 rvh->Send(new ViewMsg_PpapiBrokerPermissionResult(rvh->GetRoutingID(), |
| 2366 request_id, | 2366 request_id, |
| 2367 result)); | 2367 result)); |
| 2368 } | 2368 } |
| 2369 | 2369 |
| 2370 void WebContentsImpl::OnBrowserPluginCreateGuest( | 2370 void WebContentsImpl::OnBrowserPluginAllocateInstanceID( |
| 2371 int instance_id, | 2371 const IPC::Message& message, int request_id) { |
| 2372 const BrowserPluginHostMsg_CreateGuest_Params& params) { | |
| 2373 // This creates a BrowserPluginEmbedder, which handles all the BrowserPlugin | 2372 // This creates a BrowserPluginEmbedder, which handles all the BrowserPlugin |
| 2374 // specific messages for this WebContents (through its | 2373 // specific messages for this WebContents. This means that any message from |
| 2375 // BrowserPluginEmbedderHelper). This means that any message from browser | 2374 // a BrowserPlugin prior to AllocateInstanceID will be ignored. |
| 2376 // plugin renderer prior to CreateGuest will be ignored. | |
| 2377 // For more info, see comment above classes BrowserPluginEmbedder and | 2375 // For more info, see comment above classes BrowserPluginEmbedder and |
| 2378 // BrowserPluginGuest. | 2376 // BrowserPluginGuest. |
| 2379 // The first BrowserPluginHostMsg_CreateGuest message from this WebContents' | 2377 // The first BrowserPluginHostMsg_AllocateInstanceID message from this |
| 2380 // embedder render process is handled here. Once BrowserPluginEmbedder is | 2378 // WebContents' embedder render process is handled here. Once |
| 2381 // created, all subsequent BrowserPluginHostMsg_CreateGuest messages are | 2379 // BrowserPluginEmbedder is created, all subsequent BrowserPluginHostMsg_* |
| 2382 // intercepted by the BrowserPluginEmbedderHelper and handled by the | 2380 // messages are handled in BrowserPluginEmbedder. Thus, this code will not be |
| 2383 // BrowserPluginEmbedder. Thus, this code will not be executed if a | 2381 // executed if a BrowserPluginEmbedder exists for this WebContents. |
| 2384 // BrowserPluginEmbedder exists for this WebContents. | |
| 2385 CHECK(!browser_plugin_embedder_.get()); | 2382 CHECK(!browser_plugin_embedder_.get()); |
| 2386 browser_plugin_embedder_.reset( | 2383 browser_plugin_embedder_.reset( |
| 2387 BrowserPluginEmbedder::Create(this, GetRenderViewHost())); | 2384 BrowserPluginEmbedder::Create(this, GetRenderViewHost())); |
| 2388 BrowserPluginHostMsg_CreateGuest create_guest_msg( | 2385 browser_plugin_embedder_->OnMessageReceived(message); |
| 2389 GetRenderViewHost()->GetRoutingID(), instance_id, params); | |
| 2390 browser_plugin_embedder_->OnMessageReceived(create_guest_msg); | |
| 2391 } | 2386 } |
| 2392 | 2387 |
| 2393 void WebContentsImpl::OnDidDownloadFavicon( | 2388 void WebContentsImpl::OnDidDownloadFavicon( |
| 2394 int id, | 2389 int id, |
| 2395 const GURL& image_url, | 2390 const GURL& image_url, |
| 2396 int requested_size, | 2391 int requested_size, |
| 2397 const std::vector<SkBitmap>& bitmaps) { | 2392 const std::vector<SkBitmap>& bitmaps) { |
| 2398 FaviconDownloadMap::iterator iter = favicon_download_map_.find(id); | 2393 FaviconDownloadMap::iterator iter = favicon_download_map_.find(id); |
| 2399 if (iter == favicon_download_map_.end()) { | 2394 if (iter == favicon_download_map_.end()) { |
| 2400 // Currently WebContents notifies us of ANY downloads so that it is | 2395 // Currently WebContents notifies us of ANY downloads so that it is |
| (...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3425 | 3420 |
| 3426 BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() { | 3421 BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() { |
| 3427 return browser_plugin_guest_.get(); | 3422 return browser_plugin_guest_.get(); |
| 3428 } | 3423 } |
| 3429 | 3424 |
| 3430 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() { | 3425 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() { |
| 3431 return browser_plugin_embedder_.get(); | 3426 return browser_plugin_embedder_.get(); |
| 3432 } | 3427 } |
| 3433 | 3428 |
| 3434 } // namespace content | 3429 } // namespace content |
| OLD | NEW |