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

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: Diff against simplified focus 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 721 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 IPC_MESSAGE_HANDLER(ViewHostMsg_CrashedPlugin, OnCrashedPlugin) 732 IPC_MESSAGE_HANDLER(ViewHostMsg_CrashedPlugin, OnCrashedPlugin)
733 IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed) 733 IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed)
734 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenColorChooser, OnOpenColorChooser) 734 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenColorChooser, OnOpenColorChooser)
735 IPC_MESSAGE_HANDLER(ViewHostMsg_EndColorChooser, OnEndColorChooser) 735 IPC_MESSAGE_HANDLER(ViewHostMsg_EndColorChooser, OnEndColorChooser)
736 IPC_MESSAGE_HANDLER(ViewHostMsg_SetSelectedColorInColorChooser, 736 IPC_MESSAGE_HANDLER(ViewHostMsg_SetSelectedColorInColorChooser,
737 OnSetSelectedColorInColorChooser) 737 OnSetSelectedColorInColorChooser)
738 IPC_MESSAGE_HANDLER(ViewHostMsg_PepperPluginHung, OnPepperPluginHung) 738 IPC_MESSAGE_HANDLER(ViewHostMsg_PepperPluginHung, OnPepperPluginHung)
739 IPC_MESSAGE_HANDLER(ViewHostMsg_WebUISend, OnWebUISend) 739 IPC_MESSAGE_HANDLER(ViewHostMsg_WebUISend, OnWebUISend)
740 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestPpapiBrokerPermission, 740 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestPpapiBrokerPermission,
741 OnRequestPpapiBrokerPermission) 741 OnRequestPpapiBrokerPermission)
742 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_CreateGuest, 742 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_AllocateInstanceIDRequest,
743 OnBrowserPluginCreateGuest) 743 OnBrowserPluginAllocateInstanceID)
744 IPC_MESSAGE_HANDLER(IconHostMsg_DidDownloadFavicon, OnDidDownloadFavicon) 744 IPC_MESSAGE_HANDLER(IconHostMsg_DidDownloadFavicon, OnDidDownloadFavicon)
745 IPC_MESSAGE_HANDLER(IconHostMsg_UpdateFaviconURL, OnUpdateFaviconURL) 745 IPC_MESSAGE_HANDLER(IconHostMsg_UpdateFaviconURL, OnUpdateFaviconURL)
746 IPC_MESSAGE_UNHANDLED(handled = false) 746 IPC_MESSAGE_UNHANDLED(handled = false)
747 IPC_END_MESSAGE_MAP_EX() 747 IPC_END_MESSAGE_MAP_EX()
748 message_source_ = NULL; 748 message_source_ = NULL;
749 749
750 if (!message_is_ok) { 750 if (!message_is_ok) {
751 RecordAction(UserMetricsAction("BadMessageTerminate_RVD")); 751 RecordAction(UserMetricsAction("BadMessageTerminate_RVD"));
752 GetRenderProcessHost()->ReceivedBadMessage(); 752 GetRenderProcessHost()->ReceivedBadMessage();
753 } 753 }
(...skipping 1588 matching lines...) Expand 10 before | Expand all | Expand 10 after
2342 } 2342 }
2343 2343
2344 void WebContentsImpl::OnPpapiBrokerPermissionResult(int request_id, 2344 void WebContentsImpl::OnPpapiBrokerPermissionResult(int request_id,
2345 bool result) { 2345 bool result) {
2346 RenderViewHostImpl* rvh = GetRenderViewHostImpl(); 2346 RenderViewHostImpl* rvh = GetRenderViewHostImpl();
2347 rvh->Send(new ViewMsg_PpapiBrokerPermissionResult(rvh->GetRoutingID(), 2347 rvh->Send(new ViewMsg_PpapiBrokerPermissionResult(rvh->GetRoutingID(),
2348 request_id, 2348 request_id,
2349 result)); 2349 result));
2350 } 2350 }
2351 2351
2352 void WebContentsImpl::OnBrowserPluginCreateGuest( 2352 void WebContentsImpl::OnBrowserPluginAllocateInstanceID(int request_id) {
2353 int instance_id,
2354 const BrowserPluginHostMsg_CreateGuest_Params& params) {
2355 // This creates a BrowserPluginEmbedder, which handles all the BrowserPlugin 2353 // This creates a BrowserPluginEmbedder, which handles all the BrowserPlugin
2356 // specific messages for this WebContents (through its 2354 // specific messages for this WebContents (through its
2357 // BrowserPluginEmbedderHelper). This means that any message from browser 2355 // BrowserPluginEmbedderHelper). This means that any message from browser
2358 // plugin renderer prior to CreateGuest will be ignored. 2356 // plugin renderer prior to CreateGuest will be ignored.
2359 // For more info, see comment above classes BrowserPluginEmbedder and 2357 // For more info, see comment above classes BrowserPluginEmbedder and
2360 // BrowserPluginGuest. 2358 // BrowserPluginGuest.
2361 // The first BrowserPluginHostMsg_CreateGuest message from this WebContents' 2359 // The first BrowserPluginHostMsg_CreateGuest message from this WebContents'
lazyboy 2013/01/17 17:39:25 Update this comment.
Fady Samuel 2013/01/17 18:40:38 Done.
2362 // embedder render process is handled here. Once BrowserPluginEmbedder is 2360 // embedder render process is handled here. Once BrowserPluginEmbedder is
2363 // created, all subsequent BrowserPluginHostMsg_CreateGuest messages are 2361 // created, all subsequent BrowserPluginHostMsg_CreateGuest messages are
2364 // intercepted by the BrowserPluginEmbedderHelper and handled by the 2362 // intercepted by the BrowserPluginEmbedderHelper and handled by the
2365 // BrowserPluginEmbedder. Thus, this code will not be executed if a 2363 // BrowserPluginEmbedder. Thus, this code will not be executed if a
2366 // BrowserPluginEmbedder exists for this WebContents. 2364 // BrowserPluginEmbedder exists for this WebContents.
2367 CHECK(!browser_plugin_embedder_.get()); 2365 CHECK(!browser_plugin_embedder_.get());
2368 browser_plugin_embedder_.reset( 2366 browser_plugin_embedder_.reset(
2369 BrowserPluginEmbedder::Create(this, GetRenderViewHost())); 2367 BrowserPluginEmbedder::Create(this, GetRenderViewHost()));
2370 BrowserPluginHostMsg_CreateGuest create_guest_msg( 2368 BrowserPluginHostMsg_AllocateInstanceIDRequest request_msg(
2371 GetRenderViewHost()->GetRoutingID(), instance_id, params); 2369 GetRenderViewHost()->GetRoutingID(), request_id);
2372 browser_plugin_embedder_->OnMessageReceived(create_guest_msg); 2370 browser_plugin_embedder_->OnMessageReceived(request_msg);
2373 } 2371 }
2374 2372
2375 void WebContentsImpl::OnDidDownloadFavicon( 2373 void WebContentsImpl::OnDidDownloadFavicon(
2376 int id, 2374 int id,
2377 const GURL& image_url, 2375 const GURL& image_url,
2378 int requested_size, 2376 int requested_size,
2379 const std::vector<SkBitmap>& bitmaps) { 2377 const std::vector<SkBitmap>& bitmaps) {
2380 FaviconDownloadMap::iterator iter = favicon_download_map_.find(id); 2378 FaviconDownloadMap::iterator iter = favicon_download_map_.find(id);
2381 if (iter == favicon_download_map_.end()) { 2379 if (iter == favicon_download_map_.end()) {
2382 // Currently WebContents notifies us of ANY downloads so that it is 2380 // Currently WebContents notifies us of ANY downloads so that it is
(...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after
3407 3405
3408 BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() { 3406 BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() {
3409 return browser_plugin_guest_.get(); 3407 return browser_plugin_guest_.get();
3410 } 3408 }
3411 3409
3412 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() { 3410 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() {
3413 return browser_plugin_embedder_.get(); 3411 return browser_plugin_embedder_.get();
3414 } 3412 }
3415 3413
3416 } // namespace content 3414 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698