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

Side by Side Diff: chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.cc

Issue 11617005: Refactor PepperFlashFileHost and PepperBrokerHost to use MessageFilterHost. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years 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
« no previous file with comments | « no previous file | chrome/browser/renderer_host/pepper/pepper_broker_host.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory .h" 5 #include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory .h"
6 6
7 #include "chrome/browser/renderer_host/pepper/pepper_broker_host.h" 7 #include "chrome/browser/renderer_host/pepper/pepper_broker_message_filter.h"
8 #include "chrome/browser/renderer_host/pepper/pepper_flash_browser_host.h" 8 #include "chrome/browser/renderer_host/pepper/pepper_flash_browser_host.h"
9 #include "chrome/browser/renderer_host/pepper/pepper_flash_device_id_host.h" 9 #include "chrome/browser/renderer_host/pepper/pepper_flash_device_id_host.h"
10 #include "chrome/browser/renderer_host/pepper/pepper_talk_host.h" 10 #include "chrome/browser/renderer_host/pepper/pepper_talk_host.h"
11 #include "content/public/browser/browser_ppapi_host.h" 11 #include "content/public/browser/browser_ppapi_host.h"
12 #include "ppapi/host/message_filter_host.h"
12 #include "ppapi/host/ppapi_host.h" 13 #include "ppapi/host/ppapi_host.h"
13 #include "ppapi/host/resource_host.h" 14 #include "ppapi/host/resource_host.h"
14 #include "ppapi/proxy/ppapi_messages.h" 15 #include "ppapi/proxy/ppapi_messages.h"
15 #include "ppapi/shared_impl/ppapi_permissions.h" 16 #include "ppapi/shared_impl/ppapi_permissions.h"
16 17
18 using ppapi::host::MessageFilterHost;
17 using ppapi::host::ResourceHost; 19 using ppapi::host::ResourceHost;
20 using ppapi::host::ResourceMessageFilter;
18 21
19 namespace chrome { 22 namespace chrome {
20 23
21 ChromeBrowserPepperHostFactory::ChromeBrowserPepperHostFactory( 24 ChromeBrowserPepperHostFactory::ChromeBrowserPepperHostFactory(
22 content::BrowserPpapiHost* host) 25 content::BrowserPpapiHost* host)
23 : host_(host) { 26 : host_(host) {
24 } 27 }
25 28
26 ChromeBrowserPepperHostFactory::~ChromeBrowserPepperHostFactory() { 29 ChromeBrowserPepperHostFactory::~ChromeBrowserPepperHostFactory() {
27 } 30 }
28 31
29 scoped_ptr<ResourceHost> ChromeBrowserPepperHostFactory::CreateResourceHost( 32 scoped_ptr<ResourceHost> ChromeBrowserPepperHostFactory::CreateResourceHost(
30 ppapi::host::PpapiHost* host, 33 ppapi::host::PpapiHost* host,
31 const ppapi::proxy::ResourceMessageCallParams& params, 34 const ppapi::proxy::ResourceMessageCallParams& params,
32 PP_Instance instance, 35 PP_Instance instance,
33 const IPC::Message& message) { 36 const IPC::Message& message) {
34 DCHECK(host == host_->GetPpapiHost()); 37 DCHECK(host == host_->GetPpapiHost());
35 38
36 // Make sure the plugin is giving us a valid instance for this resource. 39 // Make sure the plugin is giving us a valid instance for this resource.
37 if (!host_->IsValidInstance(instance)) 40 if (!host_->IsValidInstance(instance))
38 return scoped_ptr<ResourceHost>(); 41 return scoped_ptr<ResourceHost>();
39 42
40 // Private interfaces. 43 // Private interfaces.
41 if (host_->GetPpapiHost()->permissions().HasPermission( 44 if (host_->GetPpapiHost()->permissions().HasPermission(
42 ppapi::PERMISSION_PRIVATE)) { 45 ppapi::PERMISSION_PRIVATE)) {
43 switch (message.type()) { 46 switch (message.type()) {
44 case PpapiHostMsg_Broker_Create::ID: 47 case PpapiHostMsg_Broker_Create::ID: {
45 return scoped_ptr<ResourceHost>(new PepperBrokerHost( 48 scoped_refptr<ResourceMessageFilter> broker_filter(
46 host_, instance, params.pp_resource())); 49 new PepperBrokerMessageFilter(instance, host_));
50 return scoped_ptr<ResourceHost>(new MessageFilterHost(
51 host_->GetPpapiHost(), instance, params.pp_resource(),
52 broker_filter));
53 }
47 case PpapiHostMsg_FlashDeviceID_Create::ID: 54 case PpapiHostMsg_FlashDeviceID_Create::ID:
48 return scoped_ptr<ResourceHost>(new PepperFlashDeviceIDHost( 55 return scoped_ptr<ResourceHost>(new PepperFlashDeviceIDHost(
49 host_, instance, params.pp_resource())); 56 host_, instance, params.pp_resource()));
50 case PpapiHostMsg_Talk_Create::ID: 57 case PpapiHostMsg_Talk_Create::ID:
51 return scoped_ptr<ResourceHost>(new PepperTalkHost( 58 return scoped_ptr<ResourceHost>(new PepperTalkHost(
52 host_, instance, params.pp_resource())); 59 host_, instance, params.pp_resource()));
53 } 60 }
54 } 61 }
55 62
56 // Flash interfaces. 63 // Flash interfaces.
57 if (host_->GetPpapiHost()->permissions().HasPermission( 64 if (host_->GetPpapiHost()->permissions().HasPermission(
58 ppapi::PERMISSION_FLASH)) { 65 ppapi::PERMISSION_FLASH)) {
59 switch (message.type()) { 66 switch (message.type()) {
60 case PpapiHostMsg_Flash_Create::ID: 67 case PpapiHostMsg_Flash_Create::ID:
61 return scoped_ptr<ResourceHost>(new PepperFlashBrowserHost( 68 return scoped_ptr<ResourceHost>(new PepperFlashBrowserHost(
62 host_, instance, params.pp_resource())); 69 host_, instance, params.pp_resource()));
63 } 70 }
64 } 71 }
65 72
66 return scoped_ptr<ResourceHost>(); 73 return scoped_ptr<ResourceHost>();
67 } 74 }
68 75
69 } // namespace chrome 76 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/renderer_host/pepper/pepper_broker_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698