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