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 "content/renderer/pepper/content_renderer_pepper_host_factory.h" | 5 #include "content/renderer/pepper/content_renderer_pepper_host_factory.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "content/renderer/pepper/pepper_audio_input_host.h" | 8 #include "content/renderer/pepper/pepper_audio_input_host.h" |
9 #include "content/renderer/pepper/pepper_file_chooser_host.h" | 9 #include "content/renderer/pepper/pepper_file_chooser_host.h" |
10 #include "content/renderer/pepper/pepper_flash_clipboard_host.h" | 10 #include "content/renderer/pepper/pepper_flash_clipboard_host.h" |
11 #include "content/renderer/pepper/pepper_flash_host.h" | 11 #include "content/renderer/pepper/pepper_flash_host.h" |
| 12 #include "content/renderer/pepper/pepper_graphics_2d_host.h" |
12 #include "content/renderer/pepper/pepper_websocket_host.h" | 13 #include "content/renderer/pepper/pepper_websocket_host.h" |
13 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" | 14 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" |
14 #include "ppapi/host/resource_host.h" | 15 #include "ppapi/host/resource_host.h" |
15 #include "ppapi/proxy/ppapi_messages.h" | 16 #include "ppapi/proxy/ppapi_messages.h" |
16 | 17 |
17 using ppapi::host::ResourceHost; | 18 using ppapi::host::ResourceHost; |
18 | 19 |
19 namespace content { | 20 namespace content { |
20 | 21 |
21 ContentRendererPepperHostFactory::ContentRendererPepperHostFactory( | 22 ContentRendererPepperHostFactory::ContentRendererPepperHostFactory( |
(...skipping 30 matching lines...) Expand all Loading... |
52 // where the permissions for bundled Flash (but not Flash that you specify | 53 // where the permissions for bundled Flash (but not Flash that you specify |
53 // on the command line, making it difficult to test) are incorrect. | 54 // on the command line, making it difficult to test) are incorrect. |
54 /*if (GetPermissions().HasPermission(ppapi::PERMISSION_DEV))*/ { | 55 /*if (GetPermissions().HasPermission(ppapi::PERMISSION_DEV))*/ { |
55 switch (message.type()) { | 56 switch (message.type()) { |
56 case PpapiHostMsg_AudioInput_Create::ID: | 57 case PpapiHostMsg_AudioInput_Create::ID: |
57 return scoped_ptr<ResourceHost>(new PepperAudioInputHost( | 58 return scoped_ptr<ResourceHost>(new PepperAudioInputHost( |
58 host_, instance, params.pp_resource())); | 59 host_, instance, params.pp_resource())); |
59 case PpapiHostMsg_FileChooser_Create::ID: | 60 case PpapiHostMsg_FileChooser_Create::ID: |
60 return scoped_ptr<ResourceHost>(new PepperFileChooserHost( | 61 return scoped_ptr<ResourceHost>(new PepperFileChooserHost( |
61 host_, instance, params.pp_resource())); | 62 host_, instance, params.pp_resource())); |
| 63 case PpapiHostMsg_Graphics2D_Create::ID: { |
| 64 PpapiHostMsg_Graphics2D_Create::Schema::Param msg_params; |
| 65 if (!PpapiHostMsg_Graphics2D_Create::Read(&message, &msg_params)) { |
| 66 NOTREACHED(); |
| 67 return scoped_ptr<ResourceHost>(); |
| 68 } |
| 69 return scoped_ptr<ResourceHost>( |
| 70 PepperGraphics2DHost::Create(host_, instance, params.pp_resource(), |
| 71 msg_params.a /* PP_Size */, |
| 72 msg_params.b /* PP_Bool */)); |
| 73 } |
62 } | 74 } |
63 } | 75 } |
64 | 76 |
65 // Resources for Flash interfaces. | 77 // Resources for Flash interfaces. |
66 if (GetPermissions().HasPermission(ppapi::PERMISSION_FLASH)) { | 78 if (GetPermissions().HasPermission(ppapi::PERMISSION_FLASH)) { |
67 switch (message.type()) { | 79 switch (message.type()) { |
68 case PpapiHostMsg_Flash_Create::ID: | 80 case PpapiHostMsg_Flash_Create::ID: |
69 return scoped_ptr<ResourceHost>(new PepperFlashHost( | 81 return scoped_ptr<ResourceHost>(new PepperFlashHost( |
70 host_, instance, params.pp_resource())); | 82 host_, instance, params.pp_resource())); |
71 case PpapiHostMsg_FlashClipboard_Create::ID: | 83 case PpapiHostMsg_FlashClipboard_Create::ID: |
72 return scoped_ptr<ResourceHost>(new PepperFlashClipboardHost( | 84 return scoped_ptr<ResourceHost>(new PepperFlashClipboardHost( |
73 host_, instance, params.pp_resource())); | 85 host_, instance, params.pp_resource())); |
74 } | 86 } |
75 } | 87 } |
76 | 88 |
77 return scoped_ptr<ResourceHost>(); | 89 return scoped_ptr<ResourceHost>(); |
78 } | 90 } |
79 | 91 |
80 const ppapi::PpapiPermissions& | 92 const ppapi::PpapiPermissions& |
81 ContentRendererPepperHostFactory::GetPermissions() const { | 93 ContentRendererPepperHostFactory::GetPermissions() const { |
82 return host_->GetPpapiHost()->permissions(); | 94 return host_->GetPpapiHost()->permissions(); |
83 } | 95 } |
84 | 96 |
85 } // namespace content | 97 } // namespace content |
OLD | NEW |