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

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: Merged with ToT 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 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 IPC_MESSAGE_HANDLER(ViewHostMsg_CrashedPlugin, OnCrashedPlugin) 738 IPC_MESSAGE_HANDLER(ViewHostMsg_CrashedPlugin, OnCrashedPlugin)
739 IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed) 739 IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed)
740 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenColorChooser, OnOpenColorChooser) 740 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenColorChooser, OnOpenColorChooser)
741 IPC_MESSAGE_HANDLER(ViewHostMsg_EndColorChooser, OnEndColorChooser) 741 IPC_MESSAGE_HANDLER(ViewHostMsg_EndColorChooser, OnEndColorChooser)
742 IPC_MESSAGE_HANDLER(ViewHostMsg_SetSelectedColorInColorChooser, 742 IPC_MESSAGE_HANDLER(ViewHostMsg_SetSelectedColorInColorChooser,
743 OnSetSelectedColorInColorChooser) 743 OnSetSelectedColorInColorChooser)
744 IPC_MESSAGE_HANDLER(ViewHostMsg_PepperPluginHung, OnPepperPluginHung) 744 IPC_MESSAGE_HANDLER(ViewHostMsg_PepperPluginHung, OnPepperPluginHung)
745 IPC_MESSAGE_HANDLER(ViewHostMsg_WebUISend, OnWebUISend) 745 IPC_MESSAGE_HANDLER(ViewHostMsg_WebUISend, OnWebUISend)
746 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestPpapiBrokerPermission, 746 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestPpapiBrokerPermission,
747 OnRequestPpapiBrokerPermission) 747 OnRequestPpapiBrokerPermission)
748 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_CreateGuest, 748 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_AllocateInstanceID,
749 OnBrowserPluginCreateGuest) 749 OnBrowserPluginAllocateInstanceID)
750 IPC_MESSAGE_HANDLER(IconHostMsg_DidDownloadFavicon, OnDidDownloadFavicon) 750 IPC_MESSAGE_HANDLER(IconHostMsg_DidDownloadFavicon, OnDidDownloadFavicon)
751 IPC_MESSAGE_HANDLER(IconHostMsg_UpdateFaviconURL, OnUpdateFaviconURL) 751 IPC_MESSAGE_HANDLER(IconHostMsg_UpdateFaviconURL, OnUpdateFaviconURL)
752 #if defined(OS_ANDROID) 752 #if defined(OS_ANDROID)
753 IPC_MESSAGE_HANDLER(ViewHostMsg_FindMatchRects_Reply, 753 IPC_MESSAGE_HANDLER(ViewHostMsg_FindMatchRects_Reply,
754 OnFindMatchRectsReply) 754 OnFindMatchRectsReply)
755 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenDateTimeDialog, 755 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenDateTimeDialog,
756 OnOpenDateTimeDialog) 756 OnOpenDateTimeDialog)
757 #endif 757 #endif
758 IPC_MESSAGE_HANDLER(ViewHostMsg_FrameDetached, OnFrameDetached) 758 IPC_MESSAGE_HANDLER(ViewHostMsg_FrameDetached, OnFrameDetached)
759 IPC_MESSAGE_UNHANDLED(handled = false) 759 IPC_MESSAGE_UNHANDLED(handled = false)
(...skipping 1605 matching lines...) Expand 10 before | Expand all | Expand 10 after
2365 } 2365 }
2366 2366
2367 void WebContentsImpl::OnPpapiBrokerPermissionResult(int request_id, 2367 void WebContentsImpl::OnPpapiBrokerPermissionResult(int request_id,
2368 bool result) { 2368 bool result) {
2369 RenderViewHostImpl* rvh = GetRenderViewHostImpl(); 2369 RenderViewHostImpl* rvh = GetRenderViewHostImpl();
2370 rvh->Send(new ViewMsg_PpapiBrokerPermissionResult(rvh->GetRoutingID(), 2370 rvh->Send(new ViewMsg_PpapiBrokerPermissionResult(rvh->GetRoutingID(),
2371 request_id, 2371 request_id,
2372 result)); 2372 result));
2373 } 2373 }
2374 2374
2375 void WebContentsImpl::OnBrowserPluginCreateGuest( 2375 void WebContentsImpl::OnBrowserPluginAllocateInstanceID(
2376 int instance_id, 2376 const IPC::Message& message, int request_id) {
2377 const BrowserPluginHostMsg_CreateGuest_Params& params) {
2378 // This creates a BrowserPluginEmbedder, which handles all the BrowserPlugin 2377 // This creates a BrowserPluginEmbedder, which handles all the BrowserPlugin
2379 // specific messages for this WebContents (through its 2378 // specific messages for this WebContents. This means that any message from
2380 // BrowserPluginEmbedderHelper). This means that any message from browser 2379 // a BrowserPlugin prior to AllocateInstanceID will be ignored.
2381 // plugin renderer prior to CreateGuest will be ignored.
2382 // For more info, see comment above classes BrowserPluginEmbedder and 2380 // For more info, see comment above classes BrowserPluginEmbedder and
2383 // BrowserPluginGuest. 2381 // BrowserPluginGuest.
2384 // The first BrowserPluginHostMsg_CreateGuest message from this WebContents' 2382 // The first BrowserPluginHostMsg_AllocateInstanceID message from this
2385 // embedder render process is handled here. Once BrowserPluginEmbedder is 2383 // WebContents' embedder render process is handled here. Once
2386 // created, all subsequent BrowserPluginHostMsg_CreateGuest messages are 2384 // BrowserPluginEmbedder is created, all subsequent BrowserPluginHostMsg_*
2387 // intercepted by the BrowserPluginEmbedderHelper and handled by the 2385 // messages are handled in BrowserPluginEmbedder. Thus, this code will not be
2388 // BrowserPluginEmbedder. Thus, this code will not be executed if a 2386 // executed if a BrowserPluginEmbedder exists for this WebContents.
2389 // BrowserPluginEmbedder exists for this WebContents.
2390 CHECK(!browser_plugin_embedder_.get()); 2387 CHECK(!browser_plugin_embedder_.get());
2391 browser_plugin_embedder_.reset( 2388 browser_plugin_embedder_.reset(
2392 BrowserPluginEmbedder::Create(this, GetRenderViewHost())); 2389 BrowserPluginEmbedder::Create(this, GetRenderViewHost()));
2393 BrowserPluginHostMsg_CreateGuest create_guest_msg( 2390 browser_plugin_embedder_->OnMessageReceived(message);
2394 GetRenderViewHost()->GetRoutingID(), instance_id, params);
2395 browser_plugin_embedder_->OnMessageReceived(create_guest_msg);
2396 } 2391 }
2397 2392
2398 void WebContentsImpl::OnDidDownloadFavicon( 2393 void WebContentsImpl::OnDidDownloadFavicon(
2399 int id, 2394 int id,
2400 const GURL& image_url, 2395 const GURL& image_url,
2401 int requested_size, 2396 int requested_size,
2402 const std::vector<SkBitmap>& bitmaps) { 2397 const std::vector<SkBitmap>& bitmaps) {
2403 FaviconDownloadMap::iterator iter = favicon_download_map_.find(id); 2398 FaviconDownloadMap::iterator iter = favicon_download_map_.find(id);
2404 if (iter == favicon_download_map_.end()) { 2399 if (iter == favicon_download_map_.end()) {
2405 // Currently WebContents notifies us of ANY downloads so that it is 2400 // Currently WebContents notifies us of ANY downloads so that it is
(...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after
3435 3430
3436 BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() { 3431 BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() {
3437 return browser_plugin_guest_.get(); 3432 return browser_plugin_guest_.get();
3438 } 3433 }
3439 3434
3440 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() { 3435 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() {
3441 return browser_plugin_embedder_.get(); 3436 return browser_plugin_embedder_.get();
3442 } 3437 }
3443 3438
3444 } // namespace content 3439 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | content/common/browser_plugin_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698