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 "webkit/plugins/ppapi/common.h" | 8 #include "webkit/plugins/ppapi/common.h" |
| 9 #include "webkit/plugins/ppapi/ppb_font_impl.h" |
9 #include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h" | 10 #include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h" |
10 #include "webkit/plugins/ppapi/ppb_image_data_impl.h" | 11 #include "webkit/plugins/ppapi/ppb_image_data_impl.h" |
11 | 12 |
12 namespace webkit { | 13 namespace webkit { |
13 namespace ppapi { | 14 namespace ppapi { |
14 | 15 |
15 ResourceCreationImpl::ResourceCreationImpl() { | 16 ResourceCreationImpl::ResourceCreationImpl() { |
16 } | 17 } |
17 | 18 |
18 ResourceCreationImpl::~ResourceCreationImpl() { | 19 ResourceCreationImpl::~ResourceCreationImpl() { |
19 } | 20 } |
20 | 21 |
21 ::ppapi::thunk::ResourceCreationAPI* | 22 ::ppapi::thunk::ResourceCreationAPI* |
22 ResourceCreationImpl::AsResourceCreation() { | 23 ResourceCreationImpl::AsResourceCreation() { |
23 return this; | 24 return this; |
24 } | 25 } |
25 | 26 |
| 27 PP_Resource ResourceCreationImpl::CreateFont( |
| 28 PP_Instance pp_instance, |
| 29 const PP_FontDescription_Dev* description) { |
| 30 PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance); |
| 31 if (!instance) |
| 32 return 0; |
| 33 |
| 34 if (!PPB_Font_Impl::IsPPFontDescriptionValid(*description)) |
| 35 return 0; |
| 36 |
| 37 scoped_refptr<PPB_Font_Impl> font(new PPB_Font_Impl(instance, *description)); |
| 38 return font->GetReference(); |
| 39 } |
| 40 |
26 PP_Resource ResourceCreationImpl::CreateGraphics2D( | 41 PP_Resource ResourceCreationImpl::CreateGraphics2D( |
27 PP_Instance pp_instance, | 42 PP_Instance pp_instance, |
28 const PP_Size& size, | 43 const PP_Size& size, |
29 PP_Bool is_always_opaque) { | 44 PP_Bool is_always_opaque) { |
30 PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance); | 45 PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance); |
31 if (!instance) | 46 if (!instance) |
32 return 0; | 47 return 0; |
33 | 48 |
34 scoped_refptr<PPB_Graphics2D_Impl> graphics_2d( | 49 scoped_refptr<PPB_Graphics2D_Impl> graphics_2d( |
35 new PPB_Graphics2D_Impl(instance)); | 50 new PPB_Graphics2D_Impl(instance)); |
(...skipping 13 matching lines...) Expand all Loading... |
49 return 0; | 64 return 0; |
50 | 65 |
51 scoped_refptr<PPB_ImageData_Impl> data(new PPB_ImageData_Impl(instance)); | 66 scoped_refptr<PPB_ImageData_Impl> data(new PPB_ImageData_Impl(instance)); |
52 if (!data->Init(format, size.width, size.height, !!init_to_zero)) | 67 if (!data->Init(format, size.width, size.height, !!init_to_zero)) |
53 return 0; | 68 return 0; |
54 return data->GetReference(); | 69 return data->GetReference(); |
55 } | 70 } |
56 | 71 |
57 } // namespace ppapi | 72 } // namespace ppapi |
58 } // namespace webkit | 73 } // namespace webkit |
OLD | NEW |