| 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 "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_message_filter.h" | 7 #include "chrome/browser/renderer_host/pepper/pepper_broker_message_filter.h" |
| 8 #include "chrome/browser/renderer_host/pepper/pepper_extensions_common_message_f
ilter.h" |
| 8 #include "chrome/browser/renderer_host/pepper/pepper_flash_browser_host.h" | 9 #include "chrome/browser/renderer_host/pepper/pepper_flash_browser_host.h" |
| 9 #include "chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_fil
ter.h" | 10 #include "chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_fil
ter.h" |
| 10 #include "chrome/browser/renderer_host/pepper/pepper_flash_device_id_host.h" | 11 #include "chrome/browser/renderer_host/pepper/pepper_flash_device_id_host.h" |
| 11 #include "chrome/browser/renderer_host/pepper/pepper_talk_host.h" | 12 #include "chrome/browser/renderer_host/pepper/pepper_talk_host.h" |
| 12 #include "content/public/browser/browser_ppapi_host.h" | 13 #include "content/public/browser/browser_ppapi_host.h" |
| 13 #include "ppapi/host/message_filter_host.h" | 14 #include "ppapi/host/message_filter_host.h" |
| 14 #include "ppapi/host/ppapi_host.h" | 15 #include "ppapi/host/ppapi_host.h" |
| 15 #include "ppapi/host/resource_host.h" | 16 #include "ppapi/host/resource_host.h" |
| 16 #include "ppapi/proxy/ppapi_messages.h" | 17 #include "ppapi/proxy/ppapi_messages.h" |
| 17 #include "ppapi/shared_impl/ppapi_permissions.h" | 18 #include "ppapi/shared_impl/ppapi_permissions.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 34 ppapi::host::PpapiHost* host, | 35 ppapi::host::PpapiHost* host, |
| 35 const ppapi::proxy::ResourceMessageCallParams& params, | 36 const ppapi::proxy::ResourceMessageCallParams& params, |
| 36 PP_Instance instance, | 37 PP_Instance instance, |
| 37 const IPC::Message& message) { | 38 const IPC::Message& message) { |
| 38 DCHECK(host == host_->GetPpapiHost()); | 39 DCHECK(host == host_->GetPpapiHost()); |
| 39 | 40 |
| 40 // Make sure the plugin is giving us a valid instance for this resource. | 41 // Make sure the plugin is giving us a valid instance for this resource. |
| 41 if (!host_->IsValidInstance(instance)) | 42 if (!host_->IsValidInstance(instance)) |
| 42 return scoped_ptr<ResourceHost>(); | 43 return scoped_ptr<ResourceHost>(); |
| 43 | 44 |
| 45 // Dev interfaces. |
| 46 if (host_->GetPpapiHost()->permissions().HasPermission( |
| 47 ppapi::PERMISSION_DEV)) { |
| 48 switch (message.type()) { |
| 49 case PpapiHostMsg_ExtensionsCommon_Create::ID: { |
| 50 scoped_refptr<ResourceMessageFilter> extensions_common_filter( |
| 51 PepperExtensionsCommonMessageFilter::Create(host_, instance)); |
| 52 if (!extensions_common_filter.get()) |
| 53 return scoped_ptr<ResourceHost>(); |
| 54 return scoped_ptr<ResourceHost>(new MessageFilterHost( |
| 55 host_->GetPpapiHost(), instance, params.pp_resource(), |
| 56 extensions_common_filter)); |
| 57 } |
| 58 } |
| 59 } |
| 60 |
| 44 // Private interfaces. | 61 // Private interfaces. |
| 45 if (host_->GetPpapiHost()->permissions().HasPermission( | 62 if (host_->GetPpapiHost()->permissions().HasPermission( |
| 46 ppapi::PERMISSION_PRIVATE)) { | 63 ppapi::PERMISSION_PRIVATE)) { |
| 47 switch (message.type()) { | 64 switch (message.type()) { |
| 48 case PpapiHostMsg_Broker_Create::ID: { | 65 case PpapiHostMsg_Broker_Create::ID: { |
| 49 scoped_refptr<ResourceMessageFilter> broker_filter( | 66 scoped_refptr<ResourceMessageFilter> broker_filter( |
| 50 new PepperBrokerMessageFilter(instance, host_)); | 67 new PepperBrokerMessageFilter(instance, host_)); |
| 51 return scoped_ptr<ResourceHost>(new MessageFilterHost( | 68 return scoped_ptr<ResourceHost>(new MessageFilterHost( |
| 52 host_->GetPpapiHost(), instance, params.pp_resource(), | 69 host_->GetPpapiHost(), instance, params.pp_resource(), |
| 53 broker_filter)); | 70 broker_filter)); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 74 } | 91 } |
| 75 case PpapiHostMsg_FlashDeviceID_Create::ID: | 92 case PpapiHostMsg_FlashDeviceID_Create::ID: |
| 76 return scoped_ptr<ResourceHost>(new PepperFlashDeviceIDHost( | 93 return scoped_ptr<ResourceHost>(new PepperFlashDeviceIDHost( |
| 77 host_, instance, params.pp_resource())); | 94 host_, instance, params.pp_resource())); |
| 78 } | 95 } |
| 79 } | 96 } |
| 80 return scoped_ptr<ResourceHost>(); | 97 return scoped_ptr<ResourceHost>(); |
| 81 } | 98 } |
| 82 | 99 |
| 83 } // namespace chrome | 100 } // namespace chrome |
| OLD | NEW |