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

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

Issue 11956022: Browser Plugin: Allocate Instance IDs in BrowserPluginEmbedder instead of BrowserPluginManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed Istiaque's comments Created 7 years, 11 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"
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_AllocateInstanceIDRequest,
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
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(int request_id) {
2371 int instance_id,
2372 const BrowserPluginHostMsg_CreateGuest_Params& params) {
2373 // This creates a BrowserPluginEmbedder, which handles all the BrowserPlugin 2371 // This creates a BrowserPluginEmbedder, which handles all the BrowserPlugin
2374 // specific messages for this WebContents (through its 2372 // specific messages for this WebContents. This means that any message from
2375 // BrowserPluginEmbedderHelper). This means that any message from browser 2373 // 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 2374 // For more info, see comment above classes BrowserPluginEmbedder and
2378 // BrowserPluginGuest. 2375 // BrowserPluginGuest.
2379 // The first BrowserPluginHostMsg_CreateGuest message from this WebContents' 2376 // The first BrowserPluginHostMsg_AllocateInstanceID message from this
2380 // embedder render process is handled here. Once BrowserPluginEmbedder is 2377 // WebContents' embedder render process is handled here. Once
2381 // created, all subsequent BrowserPluginHostMsg_CreateGuest messages are 2378 // BrowserPluginEmbedder is created, all subsequent BrowserPluginHostMsg_*
2382 // intercepted by the BrowserPluginEmbedderHelper and handled by the 2379 // messages are handled in BrowserPluginEmbedder. Thus, this code will not be
2383 // BrowserPluginEmbedder. Thus, this code will not be executed if a 2380 // executed if a BrowserPluginEmbedder exists for this WebContents.
2384 // BrowserPluginEmbedder exists for this WebContents.
2385 CHECK(!browser_plugin_embedder_.get()); 2381 CHECK(!browser_plugin_embedder_.get());
2386 browser_plugin_embedder_.reset( 2382 browser_plugin_embedder_.reset(
2387 BrowserPluginEmbedder::Create(this, GetRenderViewHost())); 2383 BrowserPluginEmbedder::Create(this, GetRenderViewHost()));
2388 BrowserPluginHostMsg_CreateGuest create_guest_msg( 2384 BrowserPluginHostMsg_AllocateInstanceIDRequest request_msg(
2389 GetRenderViewHost()->GetRoutingID(), instance_id, params); 2385 GetRenderViewHost()->GetRoutingID(), request_id);
2390 browser_plugin_embedder_->OnMessageReceived(create_guest_msg); 2386 browser_plugin_embedder_->OnMessageReceived(request_msg);
2391 } 2387 }
2392 2388
2393 void WebContentsImpl::OnDidDownloadFavicon( 2389 void WebContentsImpl::OnDidDownloadFavicon(
2394 int id, 2390 int id,
2395 const GURL& image_url, 2391 const GURL& image_url,
2396 int requested_size, 2392 int requested_size,
2397 const std::vector<SkBitmap>& bitmaps) { 2393 const std::vector<SkBitmap>& bitmaps) {
2398 FaviconDownloadMap::iterator iter = favicon_download_map_.find(id); 2394 FaviconDownloadMap::iterator iter = favicon_download_map_.find(id);
2399 if (iter == favicon_download_map_.end()) { 2395 if (iter == favicon_download_map_.end()) {
2400 // Currently WebContents notifies us of ANY downloads so that it is 2396 // Currently WebContents notifies us of ANY downloads so that it is
(...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after
3425 3421
3426 BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() { 3422 BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() {
3427 return browser_plugin_guest_.get(); 3423 return browser_plugin_guest_.get();
3428 } 3424 }
3429 3425
3430 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() { 3426 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() {
3431 return browser_plugin_embedder_.get(); 3427 return browser_plugin_embedder_.get();
3432 } 3428 }
3433 3429
3434 } // namespace content 3430 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698