| 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/renderer/pepper/pepper_in_process_resource_creation.h" | 5 #include "content/renderer/pepper/pepper_in_process_resource_creation.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "content/renderer/render_view_impl.h" | 10 #include "content/renderer/render_view_impl.h" |
| 11 #include "content/renderer/pepper/pepper_in_process_router.h" | 11 #include "content/renderer/pepper/pepper_in_process_router.h" |
| 12 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" | 12 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" |
| 13 #include "ipc/ipc_message.h" | 13 #include "ipc/ipc_message.h" |
| 14 #include "ipc/ipc_message_macros.h" | 14 #include "ipc/ipc_message_macros.h" |
| 15 #include "ppapi/host/ppapi_host.h" | 15 #include "ppapi/host/ppapi_host.h" |
| 16 #include "ppapi/proxy/browser_font_resource_trusted.h" |
| 16 #include "ppapi/proxy/file_chooser_resource.h" | 17 #include "ppapi/proxy/file_chooser_resource.h" |
| 17 #include "ppapi/proxy/ppapi_messages.h" | 18 #include "ppapi/proxy/ppapi_messages.h" |
| 18 #include "ppapi/proxy/printing_resource.h" | 19 #include "ppapi/proxy/printing_resource.h" |
| 19 #include "ppapi/proxy/url_request_info_resource.h" | 20 #include "ppapi/proxy/url_request_info_resource.h" |
| 20 #include "ppapi/proxy/url_response_info_resource.h" | 21 #include "ppapi/proxy/url_response_info_resource.h" |
| 21 #include "ppapi/proxy/websocket_resource.h" | 22 #include "ppapi/proxy/websocket_resource.h" |
| 22 #include "ppapi/shared_impl/ppapi_globals.h" | 23 #include "ppapi/shared_impl/ppapi_globals.h" |
| 23 #include "ppapi/shared_impl/ppapi_permissions.h" | 24 #include "ppapi/shared_impl/ppapi_permissions.h" |
| 24 #include "ppapi/shared_impl/resource_tracker.h" | 25 #include "ppapi/shared_impl/resource_tracker.h" |
| 25 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 26 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
| 26 | 27 |
| 27 // Note that the code in the creation functions in this file should generally | 28 // Note that the code in the creation functions in this file should generally |
| 28 // be the same as that in ppapi/proxy/resource_creation_proxy.cc. See | 29 // be the same as that in ppapi/proxy/resource_creation_proxy.cc. See |
| 29 // pepper_in_process_resource_creation.h for what this file is for. | 30 // pepper_in_process_resource_creation.h for what this file is for. |
| 30 | 31 |
| 31 namespace content { | 32 namespace content { |
| 32 | 33 |
| 33 // PepperInProcessResourceCreation -------------------------------------------- | 34 // PepperInProcessResourceCreation -------------------------------------------- |
| 34 | 35 |
| 35 PepperInProcessResourceCreation::PepperInProcessResourceCreation( | 36 PepperInProcessResourceCreation::PepperInProcessResourceCreation( |
| 36 RendererPpapiHostImpl* host_impl, | 37 RendererPpapiHostImpl* host_impl, |
| 37 webkit::ppapi::PluginInstance* instance) | 38 webkit::ppapi::PluginInstance* instance) |
| 38 : ResourceCreationImpl(instance), | 39 : ResourceCreationImpl(instance), |
| 39 host_impl_(host_impl) { | 40 host_impl_(host_impl) { |
| 40 } | 41 } |
| 41 | 42 |
| 42 PepperInProcessResourceCreation::~PepperInProcessResourceCreation() { | 43 PepperInProcessResourceCreation::~PepperInProcessResourceCreation() { |
| 43 } | 44 } |
| 44 | 45 |
| 46 PP_Resource PepperInProcessResourceCreation::CreateBrowserFont( |
| 47 PP_Instance instance, |
| 48 const PP_BrowserFont_Trusted_Description* description) { |
| 49 if (!ppapi::proxy::BrowserFontResource_Trusted::IsPPFontDescriptionValid( |
| 50 *description)) |
| 51 return 0; |
| 52 ppapi::Preferences prefs( |
| 53 host_impl_->GetRenderViewForInstance(instance)->GetWebkitPreferences()); |
| 54 return (new ppapi::proxy::BrowserFontResource_Trusted( |
| 55 host_impl_->in_process_router()->GetPluginConnection(), |
| 56 instance, |
| 57 *description, |
| 58 prefs))->GetReference(); |
| 59 } |
| 60 |
| 45 PP_Resource PepperInProcessResourceCreation::CreateFileChooser( | 61 PP_Resource PepperInProcessResourceCreation::CreateFileChooser( |
| 46 PP_Instance instance, | 62 PP_Instance instance, |
| 47 PP_FileChooserMode_Dev mode, | 63 PP_FileChooserMode_Dev mode, |
| 48 const char* accept_types) { | 64 const char* accept_types) { |
| 49 return (new ppapi::proxy::FileChooserResource( | 65 return (new ppapi::proxy::FileChooserResource( |
| 50 host_impl_->in_process_router()->GetPluginConnection(), | 66 host_impl_->in_process_router()->GetPluginConnection(), |
| 51 instance, mode, accept_types))->GetReference(); | 67 instance, mode, accept_types))->GetReference(); |
| 52 } | 68 } |
| 53 | 69 |
| 54 PP_Resource PepperInProcessResourceCreation::CreatePrinting( | 70 PP_Resource PepperInProcessResourceCreation::CreatePrinting( |
| (...skipping 21 matching lines...) Expand all Loading... |
| 76 } | 92 } |
| 77 | 93 |
| 78 PP_Resource PepperInProcessResourceCreation::CreateWebSocket( | 94 PP_Resource PepperInProcessResourceCreation::CreateWebSocket( |
| 79 PP_Instance instance) { | 95 PP_Instance instance) { |
| 80 return (new ppapi::proxy::WebSocketResource( | 96 return (new ppapi::proxy::WebSocketResource( |
| 81 host_impl_->in_process_router()->GetPluginConnection(), | 97 host_impl_->in_process_router()->GetPluginConnection(), |
| 82 instance))->GetReference(); | 98 instance))->GetReference(); |
| 83 } | 99 } |
| 84 | 100 |
| 85 } // namespace content | 101 } // namespace content |
| OLD | NEW |