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_print_settings_manager.h" | 11 #include "content/browser/renderer_host/pepper/pepper_print_settings_manager.h" |
12 #include "content/browser/renderer_host/pepper/pepper_printing_host.h" | 12 #include "content/browser/renderer_host/pepper/pepper_printing_host.h" |
13 #include "content/browser/renderer_host/pepper/pepper_udp_socket_private_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" |
18 | 19 |
19 using ppapi::host::MessageFilterHost; | 20 using ppapi::host::MessageFilterHost; |
20 using ppapi::host::ResourceHost; | 21 using ppapi::host::ResourceHost; |
21 using ppapi::host::ResourceMessageFilter; | 22 using ppapi::host::ResourceMessageFilter; |
22 | 23 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
55 scoped_ptr<PepperPrintSettingsManager> manager( | 56 scoped_ptr<PepperPrintSettingsManager> manager( |
56 new PepperPrintSettingsManagerImpl()); | 57 new PepperPrintSettingsManagerImpl()); |
57 return scoped_ptr<ResourceHost>(new PepperPrintingHost( | 58 return scoped_ptr<ResourceHost>(new PepperPrintingHost( |
58 host_->GetPpapiHost(), instance, | 59 host_->GetPpapiHost(), instance, |
59 params.pp_resource(), manager.Pass())); | 60 params.pp_resource(), manager.Pass())); |
60 } | 61 } |
61 } | 62 } |
62 } | 63 } |
63 | 64 |
64 // Private interfaces. | 65 // Private interfaces. |
65 if (GetPermissions().HasPermission(ppapi::PERMISSION_PRIVATE)) { | 66 // |
67 // Permissions for UDPSocketPrivate interface will be checked at the | |
68 // time of the instance's methods calls (because permission check | |
69 // for UDPSocketPrivate can be performed only on the UI | |
70 // thread). Currently this interface is available only for | |
71 // whitelisted apps which may not have access to the other private | |
72 // interfaces. | |
73 if (GetPermissions().HasPermission(ppapi::PERMISSION_PRIVATE) || | |
74 message.type() == PpapiHostMsg_UDPSocketPrivate_Create::ID) { | |
raymes
2013/01/15 20:58:11
I still think this could be a little clearer. Can
ygorshenin1
2013/01/16 08:13:50
Done.
| |
66 switch (message.type()) { | 75 switch (message.type()) { |
67 case PpapiHostMsg_BrowserFontSingleton_Create::ID: | 76 case PpapiHostMsg_BrowserFontSingleton_Create::ID: |
68 return scoped_ptr<ResourceHost>(new PepperBrowserFontSingletonHost( | 77 return scoped_ptr<ResourceHost>(new PepperBrowserFontSingletonHost( |
69 host_, instance, params.pp_resource())); | 78 host_, instance, params.pp_resource())); |
79 case PpapiHostMsg_UDPSocketPrivate_Create::ID: | |
80 return scoped_ptr<ResourceHost>(new PepperUDPSocketPrivateHost( | |
81 host_, instance, params.pp_resource())); | |
70 } | 82 } |
71 } | 83 } |
72 | 84 |
73 // Flash interfaces. | 85 // Flash interfaces. |
74 if (GetPermissions().HasPermission(ppapi::PERMISSION_FLASH)) { | 86 if (GetPermissions().HasPermission(ppapi::PERMISSION_FLASH)) { |
75 switch (message.type()) { | 87 switch (message.type()) { |
76 case PpapiHostMsg_FlashFile_Create::ID: { | 88 case PpapiHostMsg_FlashFile_Create::ID: { |
77 scoped_refptr<ResourceMessageFilter> file_filter( | 89 scoped_refptr<ResourceMessageFilter> file_filter( |
78 new PepperFlashFileMessageFilter(instance, host_)); | 90 new PepperFlashFileMessageFilter(instance, host_)); |
79 return scoped_ptr<ResourceHost>(new MessageFilterHost( | 91 return scoped_ptr<ResourceHost>(new MessageFilterHost( |
80 host_->GetPpapiHost(), instance, params.pp_resource(), | 92 host_->GetPpapiHost(), instance, params.pp_resource(), |
81 file_filter)); | 93 file_filter)); |
82 } | 94 } |
83 } | 95 } |
84 } | 96 } |
85 | 97 |
86 return scoped_ptr<ResourceHost>(); | 98 return scoped_ptr<ResourceHost>(); |
87 } | 99 } |
88 | 100 |
89 const ppapi::PpapiPermissions& | 101 const ppapi::PpapiPermissions& |
90 ContentBrowserPepperHostFactory::GetPermissions() const { | 102 ContentBrowserPepperHostFactory::GetPermissions() const { |
91 return host_->GetPpapiHost()->permissions(); | 103 return host_->GetPpapiHost()->permissions(); |
92 } | 104 } |
93 | 105 |
94 } // namespace content | 106 } // namespace content |
OLD | NEW |