| 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 "content/browser/renderer_host/pepper/content_browser_pepper_host_facto
ry.h" | 5 #include "content/browser/renderer_host/pepper/content_browser_pepper_host_facto
ry.h" |
| 6 | 6 |
| 7 #include "content/browser/renderer_host/pepper/browser_ppapi_host_impl.h" | 7 #include "content/browser/renderer_host/pepper/browser_ppapi_host_impl.h" |
| 8 #include "content/browser/renderer_host/pepper/pepper_browser_font_singleton_hos
t.h" | 8 #include "content/browser/renderer_host/pepper/pepper_browser_font_singleton_hos
t.h" |
| 9 #include "content/browser/renderer_host/pepper/pepper_flash_file_message_filter.
h" | 9 #include "content/browser/renderer_host/pepper/pepper_flash_file_message_filter.
h" |
| 10 #include "content/browser/renderer_host/pepper/pepper_gamepad_host.h" | 10 #include "content/browser/renderer_host/pepper/pepper_gamepad_host.h" |
| 11 #include "content/browser/renderer_host/pepper/pepper_host_resolver_private_mess
age_filter.h" | 11 #include "content/browser/renderer_host/pepper/pepper_host_resolver_message_filt
er.h" |
| 12 #include "content/browser/renderer_host/pepper/pepper_print_settings_manager.h" | 12 #include "content/browser/renderer_host/pepper/pepper_print_settings_manager.h" |
| 13 #include "content/browser/renderer_host/pepper/pepper_printing_host.h" | 13 #include "content/browser/renderer_host/pepper/pepper_printing_host.h" |
| 14 #include "content/browser/renderer_host/pepper/pepper_truetype_font_list_host.h" | 14 #include "content/browser/renderer_host/pepper/pepper_truetype_font_list_host.h" |
| 15 #include "content/browser/renderer_host/pepper/pepper_udp_socket_private_message
_filter.h" | 15 #include "content/browser/renderer_host/pepper/pepper_udp_socket_private_message
_filter.h" |
| 16 #include "ppapi/host/message_filter_host.h" | 16 #include "ppapi/host/message_filter_host.h" |
| 17 #include "ppapi/host/ppapi_host.h" | 17 #include "ppapi/host/ppapi_host.h" |
| 18 #include "ppapi/host/resource_host.h" | 18 #include "ppapi/host/resource_host.h" |
| 19 #include "ppapi/proxy/ppapi_messages.h" | 19 #include "ppapi/proxy/ppapi_messages.h" |
| 20 #include "ppapi/shared_impl/ppapi_permissions.h" | 20 #include "ppapi/shared_impl/ppapi_permissions.h" |
| 21 | 21 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 47 // Public interfaces. | 47 // Public interfaces. |
| 48 switch (message.type()) { | 48 switch (message.type()) { |
| 49 case PpapiHostMsg_Gamepad_Create::ID: | 49 case PpapiHostMsg_Gamepad_Create::ID: |
| 50 return scoped_ptr<ResourceHost>(new PepperGamepadHost( | 50 return scoped_ptr<ResourceHost>(new PepperGamepadHost( |
| 51 host_, instance, params.pp_resource())); | 51 host_, instance, params.pp_resource())); |
| 52 } | 52 } |
| 53 | 53 |
| 54 // Dev interfaces. | 54 // Dev interfaces. |
| 55 if (GetPermissions().HasPermission(ppapi::PERMISSION_DEV)) { | 55 if (GetPermissions().HasPermission(ppapi::PERMISSION_DEV)) { |
| 56 switch (message.type()) { | 56 switch (message.type()) { |
| 57 case PpapiHostMsg_HostResolver_Create::ID: { |
| 58 scoped_refptr<ResourceMessageFilter> host_resolver( |
| 59 new PepperHostResolverMessageFilter(host_, instance, false)); |
| 60 return scoped_ptr<ResourceHost>(new MessageFilterHost( |
| 61 host_->GetPpapiHost(), instance, params.pp_resource(), |
| 62 host_resolver)); |
| 63 } |
| 57 case PpapiHostMsg_Printing_Create::ID: { | 64 case PpapiHostMsg_Printing_Create::ID: { |
| 58 scoped_ptr<PepperPrintSettingsManager> manager( | 65 scoped_ptr<PepperPrintSettingsManager> manager( |
| 59 new PepperPrintSettingsManagerImpl()); | 66 new PepperPrintSettingsManagerImpl()); |
| 60 return scoped_ptr<ResourceHost>(new PepperPrintingHost( | 67 return scoped_ptr<ResourceHost>(new PepperPrintingHost( |
| 61 host_->GetPpapiHost(), instance, | 68 host_->GetPpapiHost(), instance, |
| 62 params.pp_resource(), manager.Pass())); | 69 params.pp_resource(), manager.Pass())); |
| 63 } | 70 } |
| 64 case PpapiHostMsg_TrueTypeFontSingleton_Create::ID: { | 71 case PpapiHostMsg_TrueTypeFontSingleton_Create::ID: { |
| 65 return scoped_ptr<ResourceHost>(new PepperTrueTypeFontListHost( | 72 return scoped_ptr<ResourceHost>(new PepperTrueTypeFontListHost( |
| 66 host_, instance, params.pp_resource())); | 73 host_, instance, params.pp_resource())); |
| 67 } | 74 } |
| 68 } | 75 } |
| 69 } | 76 } |
| 70 | 77 |
| 71 // Private interfaces. | 78 // Private interfaces. |
| 72 if (GetPermissions().HasPermission(ppapi::PERMISSION_PRIVATE)) { | 79 if (GetPermissions().HasPermission(ppapi::PERMISSION_PRIVATE)) { |
| 73 switch (message.type()) { | 80 switch (message.type()) { |
| 74 case PpapiHostMsg_BrowserFontSingleton_Create::ID: | 81 case PpapiHostMsg_BrowserFontSingleton_Create::ID: |
| 75 return scoped_ptr<ResourceHost>(new PepperBrowserFontSingletonHost( | 82 return scoped_ptr<ResourceHost>(new PepperBrowserFontSingletonHost( |
| 76 host_, instance, params.pp_resource())); | 83 host_, instance, params.pp_resource())); |
| 77 } | 84 } |
| 78 } | 85 } |
| 79 | 86 |
| 80 // Permissions for the following interfaces will be checked at the | 87 // Permissions for the following interfaces will be checked at the |
| 81 // time of the corresponding instance's methods calls (because | 88 // time of the corresponding instance's methods calls (because |
| 82 // permission check can be performed only on the UI | 89 // permission check can be performed only on the UI |
| 83 // thread). Currently these interfaces are available only for | 90 // thread). Currently these interfaces are available only for |
| 84 // whitelisted apps which may not have access to the other private | 91 // whitelisted apps which may not have access to the other private |
| 85 // interfaces. | 92 // interfaces. |
| 86 if (message.type() == PpapiHostMsg_HostResolverPrivate_Create::ID) { | 93 if (message.type() == PpapiHostMsg_HostResolver_CreatePrivate::ID) { |
| 87 scoped_refptr<ResourceMessageFilter> host_resolver( | 94 scoped_refptr<ResourceMessageFilter> host_resolver( |
| 88 new PepperHostResolverPrivateMessageFilter(host_, instance)); | 95 new PepperHostResolverMessageFilter(host_, instance, true)); |
| 89 return scoped_ptr<ResourceHost>(new MessageFilterHost( | 96 return scoped_ptr<ResourceHost>(new MessageFilterHost( |
| 90 host_->GetPpapiHost(), instance, params.pp_resource(), host_resolver)); | 97 host_->GetPpapiHost(), instance, params.pp_resource(), host_resolver)); |
| 91 } | 98 } |
| 92 if (message.type() == PpapiHostMsg_UDPSocketPrivate_Create::ID) { | 99 if (message.type() == PpapiHostMsg_UDPSocketPrivate_Create::ID) { |
| 93 scoped_refptr<ResourceMessageFilter> udp_socket( | 100 scoped_refptr<ResourceMessageFilter> udp_socket( |
| 94 new PepperUDPSocketPrivateMessageFilter(host_, instance)); | 101 new PepperUDPSocketPrivateMessageFilter(host_, instance)); |
| 95 return scoped_ptr<ResourceHost>(new MessageFilterHost( | 102 return scoped_ptr<ResourceHost>(new MessageFilterHost( |
| 96 host_->GetPpapiHost(), instance, params.pp_resource(), udp_socket)); | 103 host_->GetPpapiHost(), instance, params.pp_resource(), udp_socket)); |
| 97 } | 104 } |
| 98 | 105 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 111 | 118 |
| 112 return scoped_ptr<ResourceHost>(); | 119 return scoped_ptr<ResourceHost>(); |
| 113 } | 120 } |
| 114 | 121 |
| 115 const ppapi::PpapiPermissions& | 122 const ppapi::PpapiPermissions& |
| 116 ContentBrowserPepperHostFactory::GetPermissions() const { | 123 ContentBrowserPepperHostFactory::GetPermissions() const { |
| 117 return host_->GetPpapiHost()->permissions(); | 124 return host_->GetPpapiHost()->permissions(); |
| 118 } | 125 } |
| 119 | 126 |
| 120 } // namespace content | 127 } // namespace content |
| OLD | NEW |