| 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" |
| 13 #include "webkit/plugins/ppapi/ppb_font_impl.h" | 18 #include "webkit/plugins/ppapi/ppb_font_impl.h" |
| 14 #include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h" | 19 #include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h" |
| 15 #include "webkit/plugins/ppapi/ppb_image_data_impl.h" | 20 #include "webkit/plugins/ppapi/ppb_image_data_impl.h" |
| 16 | 21 |
| 17 namespace webkit { | 22 namespace webkit { |
| 18 namespace ppapi { | 23 namespace ppapi { |
| 19 | 24 |
| 20 ResourceCreationImpl::ResourceCreationImpl(PluginInstance* instance) | 25 ResourceCreationImpl::ResourceCreationImpl(PluginInstance* instance) |
| 21 : instance_(instance) { | 26 : instance_(instance) { |
| 22 } | 27 } |
| 23 | 28 |
| 24 ResourceCreationImpl::~ResourceCreationImpl() { | 29 ResourceCreationImpl::~ResourceCreationImpl() { |
| 25 } | 30 } |
| 26 | 31 |
| 27 ::ppapi::thunk::ResourceCreationAPI* | 32 ::ppapi::thunk::ResourceCreationAPI* |
| 28 ResourceCreationImpl::AsResourceCreation() { | 33 ResourceCreationImpl::AsResourceCreationAPI() { |
| 29 return this; | 34 return this; |
| 30 } | 35 } |
| 31 | 36 |
| 32 PP_Resource ResourceCreationImpl::CreateAudio( | 37 PP_Resource ResourceCreationImpl::CreateAudio( |
| 33 PP_Instance instance_id, | 38 PP_Instance instance_id, |
| 34 PP_Resource config_id, | 39 PP_Resource config_id, |
| 35 PPB_Audio_Callback audio_callback, | 40 PPB_Audio_Callback audio_callback, |
| 36 void* user_data) { | 41 void* user_data) { |
| 37 PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id); | 42 PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id); |
| 38 if (!instance) | 43 if (!instance) |
| (...skipping 29 matching lines...) Expand all Loading... |
| 68 | 73 |
| 69 PP_Resource ResourceCreationImpl::CreateBroker(PP_Instance instance) { | 74 PP_Resource ResourceCreationImpl::CreateBroker(PP_Instance instance) { |
| 70 return PPB_Broker_Impl::Create(instance); | 75 return PPB_Broker_Impl::Create(instance); |
| 71 } | 76 } |
| 72 | 77 |
| 73 PP_Resource ResourceCreationImpl::CreateBuffer(PP_Instance instance, | 78 PP_Resource ResourceCreationImpl::CreateBuffer(PP_Instance instance, |
| 74 uint32_t size) { | 79 uint32_t size) { |
| 75 return PPB_Buffer_Impl::Create(instance, size); | 80 return PPB_Buffer_Impl::Create(instance, size); |
| 76 } | 81 } |
| 77 | 82 |
| 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 |
| 78 PP_Resource ResourceCreationImpl::CreateFontObject( | 109 PP_Resource ResourceCreationImpl::CreateFontObject( |
| 79 PP_Instance pp_instance, | 110 PP_Instance pp_instance, |
| 80 const PP_FontDescription_Dev* description) { | 111 const PP_FontDescription_Dev* description) { |
| 81 PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance); | 112 PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance); |
| 82 if (!instance) | 113 if (!instance) |
| 83 return 0; | 114 return 0; |
| 84 | 115 |
| 85 if (!::ppapi::FontImpl::IsPPFontDescriptionValid(*description)) | 116 if (!::ppapi::FontImpl::IsPPFontDescriptionValid(*description)) |
| 86 return 0; | 117 return 0; |
| 87 | 118 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 115 return 0; | 146 return 0; |
| 116 | 147 |
| 117 scoped_refptr<PPB_ImageData_Impl> data(new PPB_ImageData_Impl(instance)); | 148 scoped_refptr<PPB_ImageData_Impl> data(new PPB_ImageData_Impl(instance)); |
| 118 if (!data->Init(format, size.width, size.height, !!init_to_zero)) | 149 if (!data->Init(format, size.width, size.height, !!init_to_zero)) |
| 119 return 0; | 150 return 0; |
| 120 return data->GetReference(); | 151 return data->GetReference(); |
| 121 } | 152 } |
| 122 | 153 |
| 123 } // namespace ppapi | 154 } // namespace ppapi |
| 124 } // namespace webkit | 155 } // namespace webkit |
| OLD | NEW |