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 "chrome/renderer/pepper/chrome_renderer_pepper_host_factory.h" | 5 #include "chrome/renderer/pepper/chrome_renderer_pepper_host_factory.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/renderer/pepper/pepper_flash_font_file_host.h" | 8 #include "chrome/renderer/pepper/pepper_flash_font_file_host.h" |
9 #include "content/public/renderer/renderer_ppapi_host.h" | 9 #include "content/public/renderer/renderer_ppapi_host.h" |
10 #include "ppapi/host/ppapi_host.h" | 10 #include "ppapi/host/ppapi_host.h" |
11 #include "ppapi/host/resource_host.h" | 11 #include "ppapi/host/resource_host.h" |
12 #include "ppapi/proxy/ppapi_messages.h" | 12 #include "ppapi/proxy/ppapi_messages.h" |
| 13 #include "ppapi/proxy/ppapi_message_utils.h" |
13 #include "ppapi/shared_impl/ppapi_permissions.h" | 14 #include "ppapi/shared_impl/ppapi_permissions.h" |
14 | 15 |
15 using ppapi::host::ResourceHost; | 16 using ppapi::host::ResourceHost; |
16 | 17 |
17 namespace chrome { | 18 namespace chrome { |
18 | 19 |
19 ChromeRendererPepperHostFactory::ChromeRendererPepperHostFactory( | 20 ChromeRendererPepperHostFactory::ChromeRendererPepperHostFactory( |
20 content::RendererPpapiHost* host) | 21 content::RendererPpapiHost* host) |
21 : host_(host) { | 22 : host_(host) { |
22 } | 23 } |
(...skipping 10 matching lines...) Expand all Loading... |
33 DCHECK(host == host_->GetPpapiHost()); | 34 DCHECK(host == host_->GetPpapiHost()); |
34 | 35 |
35 // Make sure the plugin is giving us a valid instance for this resource. | 36 // Make sure the plugin is giving us a valid instance for this resource. |
36 if (!host_->IsValidInstance(instance)) | 37 if (!host_->IsValidInstance(instance)) |
37 return scoped_ptr<ResourceHost>(); | 38 return scoped_ptr<ResourceHost>(); |
38 | 39 |
39 if (host_->GetPpapiHost()->permissions().HasPermission( | 40 if (host_->GetPpapiHost()->permissions().HasPermission( |
40 ppapi::PERMISSION_FLASH)) { | 41 ppapi::PERMISSION_FLASH)) { |
41 switch (message.type()) { | 42 switch (message.type()) { |
42 case PpapiHostMsg_FlashFontFile_Create::ID: | 43 case PpapiHostMsg_FlashFontFile_Create::ID: |
43 PpapiHostMsg_FlashFontFile_Create::Param param; | 44 ppapi::proxy::SerializedFontDescription description; |
44 if (PpapiHostMsg_FlashFontFile_Create::Read(&message, ¶m)) { | 45 PP_PrivateFontCharset charset; |
| 46 if (ppapi::UnpackMessage<PpapiHostMsg_FlashFontFile_Create>( |
| 47 message, &description, &charset)) { |
45 return scoped_ptr<ResourceHost>(new PepperFlashFontFileHost( | 48 return scoped_ptr<ResourceHost>(new PepperFlashFontFileHost( |
46 host_, instance, params.pp_resource(), param.a, param.b)); | 49 host_, instance, params.pp_resource(), description, charset)); |
47 } | 50 } |
48 break; | 51 break; |
49 } | 52 } |
50 } | 53 } |
51 | 54 |
52 return scoped_ptr<ResourceHost>(); | 55 return scoped_ptr<ResourceHost>(); |
53 } | 56 } |
54 | 57 |
55 } // namespace chrome | 58 } // namespace chrome |
OLD | NEW |