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" |
(...skipping 19 matching lines...) Expand all Loading... |
30 ppapi::host::PpapiHost* host, | 30 ppapi::host::PpapiHost* host, |
31 const ppapi::proxy::ResourceMessageCallParams& params, | 31 const ppapi::proxy::ResourceMessageCallParams& params, |
32 PP_Instance instance, | 32 PP_Instance instance, |
33 const IPC::Message& message) { | 33 const IPC::Message& message) { |
34 DCHECK(host == host_->GetPpapiHost()); | 34 DCHECK(host == host_->GetPpapiHost()); |
35 | 35 |
36 // 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. |
37 if (!host_->IsValidInstance(instance)) | 37 if (!host_->IsValidInstance(instance)) |
38 return scoped_ptr<ResourceHost>(); | 38 return scoped_ptr<ResourceHost>(); |
39 | 39 |
40 // Stable interfaces. | 40 // Public interfaces. |
41 switch (message.type()) { | 41 switch (message.type()) { |
42 case PpapiHostMsg_WebSocket_Create::ID: | 42 case PpapiHostMsg_WebSocket_Create::ID: |
43 return scoped_ptr<ResourceHost>(new PepperWebSocketHost( | 43 return scoped_ptr<ResourceHost>(new PepperWebSocketHost( |
44 host_, instance, params.pp_resource())); | 44 host_, instance, params.pp_resource())); |
45 } | 45 } |
46 | 46 |
47 // Resources for dev interfaces. | 47 // Dev interfaces. |
48 // TODO(brettw) when we support any public or private interfaces, put them in | 48 if (GetPermissions().HasPermission(ppapi::PERMISSION_DEV)) { |
49 // a separate switch above. | |
50 | |
51 // TODO(brettw) put back this dev check! This was removed to fix issue 138902 | |
52 // 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 /*if (GetPermissions().HasPermission(ppapi::PERMISSION_DEV))*/ { | |
55 switch (message.type()) { | 49 switch (message.type()) { |
56 case PpapiHostMsg_AudioInput_Create::ID: | 50 case PpapiHostMsg_AudioInput_Create::ID: |
57 return scoped_ptr<ResourceHost>(new PepperAudioInputHost( | 51 return scoped_ptr<ResourceHost>(new PepperAudioInputHost( |
58 host_, instance, params.pp_resource())); | 52 host_, instance, params.pp_resource())); |
59 case PpapiHostMsg_FileChooser_Create::ID: | 53 case PpapiHostMsg_FileChooser_Create::ID: |
60 return scoped_ptr<ResourceHost>(new PepperFileChooserHost( | 54 return scoped_ptr<ResourceHost>(new PepperFileChooserHost( |
61 host_, instance, params.pp_resource())); | 55 host_, instance, params.pp_resource())); |
62 } | 56 } |
63 } | 57 } |
64 | 58 |
65 // Resources for Flash interfaces. | 59 // Flash interfaces. |
66 if (GetPermissions().HasPermission(ppapi::PERMISSION_FLASH)) { | 60 if (GetPermissions().HasPermission(ppapi::PERMISSION_FLASH)) { |
67 switch (message.type()) { | 61 switch (message.type()) { |
68 case PpapiHostMsg_Flash_Create::ID: | 62 case PpapiHostMsg_Flash_Create::ID: |
69 return scoped_ptr<ResourceHost>(new PepperFlashHost( | 63 return scoped_ptr<ResourceHost>(new PepperFlashHost( |
70 host_, instance, params.pp_resource())); | 64 host_, instance, params.pp_resource())); |
71 case PpapiHostMsg_FlashClipboard_Create::ID: | 65 case PpapiHostMsg_FlashClipboard_Create::ID: |
72 return scoped_ptr<ResourceHost>(new PepperFlashClipboardHost( | 66 return scoped_ptr<ResourceHost>(new PepperFlashClipboardHost( |
73 host_, instance, params.pp_resource())); | 67 host_, instance, params.pp_resource())); |
74 } | 68 } |
75 } | 69 } |
76 | 70 |
77 return scoped_ptr<ResourceHost>(); | 71 return scoped_ptr<ResourceHost>(); |
78 } | 72 } |
79 | 73 |
80 const ppapi::PpapiPermissions& | 74 const ppapi::PpapiPermissions& |
81 ContentRendererPepperHostFactory::GetPermissions() const { | 75 ContentRendererPepperHostFactory::GetPermissions() const { |
82 return host_->GetPpapiHost()->permissions(); | 76 return host_->GetPpapiHost()->permissions(); |
83 } | 77 } |
84 | 78 |
85 } // namespace content | 79 } // namespace content |
OLD | NEW |