| 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 "ppapi/proxy/resource_creation_proxy.h" | 5 #include "ppapi/proxy/resource_creation_proxy.h" |
| 6 | 6 |
| 7 #include "ppapi/c/pp_errors.h" | 7 #include "ppapi/c/pp_errors.h" |
| 8 #include "ppapi/c/pp_size.h" | 8 #include "ppapi/c/pp_size.h" |
| 9 #include "ppapi/c/trusted/ppb_image_data_trusted.h" | 9 #include "ppapi/c/trusted/ppb_image_data_trusted.h" |
| 10 #include "ppapi/proxy/audio_input_resource.h" | 10 #include "ppapi/proxy/audio_input_resource.h" |
| 11 #include "ppapi/proxy/browser_font_resource_trusted.h" |
| 11 #include "ppapi/proxy/connection.h" | 12 #include "ppapi/proxy/connection.h" |
| 12 #include "ppapi/proxy/file_chooser_resource.h" | 13 #include "ppapi/proxy/file_chooser_resource.h" |
| 13 #include "ppapi/proxy/flash_device_id_resource.h" | 14 #include "ppapi/proxy/flash_device_id_resource.h" |
| 14 #include "ppapi/proxy/flash_font_file_resource.h" | 15 #include "ppapi/proxy/flash_font_file_resource.h" |
| 15 #include "ppapi/proxy/flash_menu_resource.h" | 16 #include "ppapi/proxy/flash_menu_resource.h" |
| 16 #include "ppapi/proxy/plugin_dispatcher.h" | 17 #include "ppapi/proxy/plugin_dispatcher.h" |
| 17 #include "ppapi/proxy/plugin_globals.h" | 18 #include "ppapi/proxy/plugin_globals.h" |
| 18 #include "ppapi/proxy/plugin_proxy_delegate.h" | 19 #include "ppapi/proxy/plugin_proxy_delegate.h" |
| 19 #include "ppapi/proxy/plugin_resource_tracker.h" | 20 #include "ppapi/proxy/plugin_resource_tracker.h" |
| 20 #include "ppapi/proxy/ppapi_messages.h" | 21 #include "ppapi/proxy/ppapi_messages.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 40 #include "ppapi/proxy/printing_resource.h" | 41 #include "ppapi/proxy/printing_resource.h" |
| 41 #include "ppapi/proxy/url_request_info_resource.h" | 42 #include "ppapi/proxy/url_request_info_resource.h" |
| 42 #include "ppapi/proxy/url_response_info_resource.h" | 43 #include "ppapi/proxy/url_response_info_resource.h" |
| 43 #include "ppapi/proxy/video_capture_resource.h" | 44 #include "ppapi/proxy/video_capture_resource.h" |
| 44 #include "ppapi/proxy/websocket_resource.h" | 45 #include "ppapi/proxy/websocket_resource.h" |
| 45 #include "ppapi/shared_impl/api_id.h" | 46 #include "ppapi/shared_impl/api_id.h" |
| 46 #include "ppapi/shared_impl/host_resource.h" | 47 #include "ppapi/shared_impl/host_resource.h" |
| 47 #include "ppapi/shared_impl/ppb_audio_config_shared.h" | 48 #include "ppapi/shared_impl/ppb_audio_config_shared.h" |
| 48 #include "ppapi/shared_impl/ppb_input_event_shared.h" | 49 #include "ppapi/shared_impl/ppb_input_event_shared.h" |
| 49 #include "ppapi/shared_impl/ppb_resource_array_shared.h" | 50 #include "ppapi/shared_impl/ppb_resource_array_shared.h" |
| 50 #include "ppapi/shared_impl/private/ppb_browser_font_trusted_shared.h" | |
| 51 #include "ppapi/shared_impl/var.h" | 51 #include "ppapi/shared_impl/var.h" |
| 52 #include "ppapi/thunk/enter.h" | 52 #include "ppapi/thunk/enter.h" |
| 53 #include "ppapi/thunk/ppb_image_data_api.h" | 53 #include "ppapi/thunk/ppb_image_data_api.h" |
| 54 | 54 |
| 55 using ppapi::thunk::ResourceCreationAPI; | 55 using ppapi::thunk::ResourceCreationAPI; |
| 56 | 56 |
| 57 namespace ppapi { | 57 namespace ppapi { |
| 58 namespace proxy { | 58 namespace proxy { |
| 59 | 59 |
| 60 ResourceCreationProxy::ResourceCreationProxy(Dispatcher* dispatcher) | 60 ResourceCreationProxy::ResourceCreationProxy(Dispatcher* dispatcher) |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 PP_Resource ResourceCreationProxy::CreateBroker(PP_Instance instance) { | 286 PP_Resource ResourceCreationProxy::CreateBroker(PP_Instance instance) { |
| 287 return PPB_Broker_Proxy::CreateProxyResource(instance); | 287 return PPB_Broker_Proxy::CreateProxyResource(instance); |
| 288 } | 288 } |
| 289 | 289 |
| 290 PP_Resource ResourceCreationProxy::CreateBrowserFont( | 290 PP_Resource ResourceCreationProxy::CreateBrowserFont( |
| 291 PP_Instance instance, | 291 PP_Instance instance, |
| 292 const PP_BrowserFont_Trusted_Description* description) { | 292 const PP_BrowserFont_Trusted_Description* description) { |
| 293 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); | 293 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); |
| 294 if (!dispatcher) | 294 if (!dispatcher) |
| 295 return 0; | 295 return 0; |
| 296 return PPB_BrowserFont_Trusted_Shared::Create( | 296 if (!BrowserFontResource_Trusted::IsPPFontDescriptionValid(*description)) |
| 297 OBJECT_IS_PROXY, instance, *description, dispatcher->preferences()); | 297 return 0; |
| 298 return (new BrowserFontResource_Trusted(GetConnection(), instance, |
| 299 *description, dispatcher->preferences()))->GetReference(); |
| 298 } | 300 } |
| 299 | 301 |
| 300 PP_Resource ResourceCreationProxy::CreateBuffer(PP_Instance instance, | 302 PP_Resource ResourceCreationProxy::CreateBuffer(PP_Instance instance, |
| 301 uint32_t size) { | 303 uint32_t size) { |
| 302 return PPB_Buffer_Proxy::CreateProxyResource(instance, size); | 304 return PPB_Buffer_Proxy::CreateProxyResource(instance, size); |
| 303 } | 305 } |
| 304 | 306 |
| 305 PP_Resource ResourceCreationProxy::CreateDirectoryReader( | 307 PP_Resource ResourceCreationProxy::CreateDirectoryReader( |
| 306 PP_Resource directory_ref) { | 308 PP_Resource directory_ref) { |
| 307 NOTIMPLEMENTED(); // Not proxied yet. | 309 NOTIMPLEMENTED(); // Not proxied yet. |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 } | 386 } |
| 385 | 387 |
| 386 Connection ResourceCreationProxy::GetConnection() { | 388 Connection ResourceCreationProxy::GetConnection() { |
| 387 return Connection( | 389 return Connection( |
| 388 PluginGlobals::Get()->plugin_proxy_delegate()->GetBrowserSender(), | 390 PluginGlobals::Get()->plugin_proxy_delegate()->GetBrowserSender(), |
| 389 dispatcher()); | 391 dispatcher()); |
| 390 } | 392 } |
| 391 | 393 |
| 392 } // namespace proxy | 394 } // namespace proxy |
| 393 } // namespace ppapi | 395 } // namespace ppapi |
| OLD | NEW |