| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "webkit/plugins/ppapi/resource_creation_impl.h" | 5 #include "webkit/plugins/ppapi/resource_creation_impl.h" |
| 6 | 6 |
| 7 #include "ppapi/c/pp_size.h" | 7 #include "ppapi/c/pp_size.h" |
| 8 #include "ppapi/shared_impl/font_impl.h" | 8 #include "ppapi/shared_impl/font_impl.h" |
| 9 #include "webkit/plugins/ppapi/common.h" | 9 #include "webkit/plugins/ppapi/common.h" |
| 10 #include "webkit/plugins/ppapi/ppb_audio_impl.h" | 10 #include "webkit/plugins/ppapi/ppb_audio_impl.h" |
| 11 #include "webkit/plugins/ppapi/ppb_broker_impl.h" | 11 #include "webkit/plugins/ppapi/ppb_broker_impl.h" |
| 12 #include "webkit/plugins/ppapi/ppb_buffer_impl.h" | 12 #include "webkit/plugins/ppapi/ppb_buffer_impl.h" |
| 13 #include "webkit/plugins/ppapi/ppb_directory_reader_impl.h" | |
| 14 #include "webkit/plugins/ppapi/ppb_file_chooser_impl.h" | |
| 15 #include "webkit/plugins/ppapi/ppb_file_io_impl.h" | |
| 16 #include "webkit/plugins/ppapi/ppb_file_ref_impl.h" | |
| 17 #include "webkit/plugins/ppapi/ppb_file_system_impl.h" | |
| 18 #include "webkit/plugins/ppapi/ppb_font_impl.h" | 13 #include "webkit/plugins/ppapi/ppb_font_impl.h" |
| 19 #include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h" | 14 #include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h" |
| 20 #include "webkit/plugins/ppapi/ppb_image_data_impl.h" | 15 #include "webkit/plugins/ppapi/ppb_image_data_impl.h" |
| 21 | 16 |
| 22 namespace webkit { | 17 namespace webkit { |
| 23 namespace ppapi { | 18 namespace ppapi { |
| 24 | 19 |
| 25 ResourceCreationImpl::ResourceCreationImpl(PluginInstance* instance) | 20 ResourceCreationImpl::ResourceCreationImpl(PluginInstance* instance) |
| 26 : instance_(instance) { | 21 : instance_(instance) { |
| 27 } | 22 } |
| 28 | 23 |
| 29 ResourceCreationImpl::~ResourceCreationImpl() { | 24 ResourceCreationImpl::~ResourceCreationImpl() { |
| 30 } | 25 } |
| 31 | 26 |
| 32 ::ppapi::thunk::ResourceCreationAPI* | 27 ::ppapi::thunk::ResourceCreationAPI* |
| 33 ResourceCreationImpl::AsResourceCreationAPI() { | 28 ResourceCreationImpl::AsResourceCreation() { |
| 34 return this; | 29 return this; |
| 35 } | 30 } |
| 36 | 31 |
| 37 PP_Resource ResourceCreationImpl::CreateAudio( | 32 PP_Resource ResourceCreationImpl::CreateAudio( |
| 38 PP_Instance instance_id, | 33 PP_Instance instance_id, |
| 39 PP_Resource config_id, | 34 PP_Resource config_id, |
| 40 PPB_Audio_Callback audio_callback, | 35 PPB_Audio_Callback audio_callback, |
| 41 void* user_data) { | 36 void* user_data) { |
| 42 PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id); | 37 PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id); |
| 43 if (!instance) | 38 if (!instance) |
| (...skipping 29 matching lines...) Expand all Loading... |
| 73 | 68 |
| 74 PP_Resource ResourceCreationImpl::CreateBroker(PP_Instance instance) { | 69 PP_Resource ResourceCreationImpl::CreateBroker(PP_Instance instance) { |
| 75 return PPB_Broker_Impl::Create(instance); | 70 return PPB_Broker_Impl::Create(instance); |
| 76 } | 71 } |
| 77 | 72 |
| 78 PP_Resource ResourceCreationImpl::CreateBuffer(PP_Instance instance, | 73 PP_Resource ResourceCreationImpl::CreateBuffer(PP_Instance instance, |
| 79 uint32_t size) { | 74 uint32_t size) { |
| 80 return PPB_Buffer_Impl::Create(instance, size); | 75 return PPB_Buffer_Impl::Create(instance, size); |
| 81 } | 76 } |
| 82 | 77 |
| 83 PP_Resource ResourceCreationImpl::CreateDirectoryReader( | |
| 84 PP_Resource directory_ref) { | |
| 85 return PPB_DirectoryReader_Impl::Create(directory_ref); | |
| 86 } | |
| 87 | |
| 88 PP_Resource ResourceCreationImpl::CreateFileChooser( | |
| 89 PP_Instance instance, | |
| 90 const PP_FileChooserOptions_Dev* options) { | |
| 91 return PPB_FileChooser_Impl::Create(instance, options); | |
| 92 } | |
| 93 | |
| 94 PP_Resource ResourceCreationImpl::CreateFileIO(PP_Instance instance) { | |
| 95 return PPB_FileIO_Impl::Create(instance); | |
| 96 } | |
| 97 | |
| 98 PP_Resource ResourceCreationImpl::CreateFileRef(PP_Resource file_system, | |
| 99 const char* path) { | |
| 100 return PPB_FileRef_Impl::Create(file_system, path); | |
| 101 } | |
| 102 | |
| 103 PP_Resource ResourceCreationImpl::CreateFileSystem( | |
| 104 PP_Instance instance, | |
| 105 PP_FileSystemType_Dev type) { | |
| 106 return PPB_FileSystem_Impl::Create(instance, type); | |
| 107 } | |
| 108 | |
| 109 PP_Resource ResourceCreationImpl::CreateFontObject( | 78 PP_Resource ResourceCreationImpl::CreateFontObject( |
| 110 PP_Instance pp_instance, | 79 PP_Instance pp_instance, |
| 111 const PP_FontDescription_Dev* description) { | 80 const PP_FontDescription_Dev* description) { |
| 112 PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance); | 81 PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance); |
| 113 if (!instance) | 82 if (!instance) |
| 114 return 0; | 83 return 0; |
| 115 | 84 |
| 116 if (!::ppapi::FontImpl::IsPPFontDescriptionValid(*description)) | 85 if (!::ppapi::FontImpl::IsPPFontDescriptionValid(*description)) |
| 117 return 0; | 86 return 0; |
| 118 | 87 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 146 return 0; | 115 return 0; |
| 147 | 116 |
| 148 scoped_refptr<PPB_ImageData_Impl> data(new PPB_ImageData_Impl(instance)); | 117 scoped_refptr<PPB_ImageData_Impl> data(new PPB_ImageData_Impl(instance)); |
| 149 if (!data->Init(format, size.width, size.height, !!init_to_zero)) | 118 if (!data->Init(format, size.width, size.height, !!init_to_zero)) |
| 150 return 0; | 119 return 0; |
| 151 return data->GetReference(); | 120 return data->GetReference(); |
| 152 } | 121 } |
| 153 | 122 |
| 154 } // namespace ppapi | 123 } // namespace ppapi |
| 155 } // namespace webkit | 124 } // namespace webkit |
| OLD | NEW |