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/browser/renderer_host/pepper/content_browser_pepper_host_facto
ry.h" | 5 #include "content/browser/renderer_host/pepper/content_browser_pepper_host_facto
ry.h" |
6 | 6 |
7 #include "content/browser/renderer_host/pepper/browser_ppapi_host_impl.h" | 7 #include "content/browser/renderer_host/pepper/browser_ppapi_host_impl.h" |
| 8 #include "content/browser/renderer_host/pepper/pepper_flash_file_host.h" |
8 #include "content/browser/renderer_host/pepper/pepper_gamepad_host.h" | 9 #include "content/browser/renderer_host/pepper/pepper_gamepad_host.h" |
9 #include "content/browser/renderer_host/pepper/pepper_print_settings_manager.h" | 10 #include "content/browser/renderer_host/pepper/pepper_print_settings_manager.h" |
10 #include "content/browser/renderer_host/pepper/pepper_printing_host.h" | 11 #include "content/browser/renderer_host/pepper/pepper_printing_host.h" |
11 #include "ppapi/host/resource_host.h" | 12 #include "ppapi/host/resource_host.h" |
12 #include "ppapi/proxy/ppapi_messages.h" | 13 #include "ppapi/proxy/ppapi_messages.h" |
| 14 #include "ppapi/shared_impl/ppapi_permissions.h" |
13 | 15 |
14 using ppapi::host::ResourceHost; | 16 using ppapi::host::ResourceHost; |
15 | 17 |
16 namespace content { | 18 namespace content { |
17 | 19 |
18 ContentBrowserPepperHostFactory::ContentBrowserPepperHostFactory( | 20 ContentBrowserPepperHostFactory::ContentBrowserPepperHostFactory( |
19 BrowserPpapiHostImpl* host) | 21 BrowserPpapiHostImpl* host) |
20 : host_(host) { | 22 : host_(host) { |
21 } | 23 } |
22 | 24 |
(...skipping 12 matching lines...) Expand all Loading... |
35 return scoped_ptr<ResourceHost>(); | 37 return scoped_ptr<ResourceHost>(); |
36 | 38 |
37 // Public interfaces. | 39 // Public interfaces. |
38 switch (message.type()) { | 40 switch (message.type()) { |
39 case PpapiHostMsg_Gamepad_Create::ID: | 41 case PpapiHostMsg_Gamepad_Create::ID: |
40 return scoped_ptr<ResourceHost>(new PepperGamepadHost( | 42 return scoped_ptr<ResourceHost>(new PepperGamepadHost( |
41 host_, instance, params.pp_resource())); | 43 host_, instance, params.pp_resource())); |
42 } | 44 } |
43 | 45 |
44 // Dev interfaces. | 46 // Dev interfaces. |
45 if (host_->GetPpapiHost()->permissions().HasPermission( | 47 if (GetPermissions().HasPermission(ppapi::PERMISSION_DEV)) { |
46 ppapi::PERMISSION_DEV)) { | |
47 switch (message.type()) { | 48 switch (message.type()) { |
48 case PpapiHostMsg_Printing_Create::ID: { | 49 case PpapiHostMsg_Printing_Create::ID: { |
49 scoped_ptr<PepperPrintSettingsManager> manager( | 50 scoped_ptr<PepperPrintSettingsManager> manager( |
50 new PepperPrintSettingsManagerImpl()); | 51 new PepperPrintSettingsManagerImpl()); |
51 return scoped_ptr<ResourceHost>(new PepperPrintingHost( | 52 return scoped_ptr<ResourceHost>(new PepperPrintingHost( |
52 host_->GetPpapiHost(), instance, | 53 host_->GetPpapiHost(), instance, |
53 params.pp_resource(), manager.Pass())); | 54 params.pp_resource(), manager.Pass())); |
54 } | 55 } |
55 } | 56 } |
56 } | 57 } |
| 58 |
| 59 // Resources for Flash interfaces. |
| 60 if (GetPermissions().HasPermission(ppapi::PERMISSION_FLASH)) { |
| 61 switch (message.type()) { |
| 62 case PpapiHostMsg_FlashFile_Create::ID: |
| 63 return scoped_ptr<ResourceHost>(new PepperFlashFileHost( |
| 64 host_, instance, params.pp_resource())); |
| 65 } |
| 66 } |
| 67 |
57 return scoped_ptr<ResourceHost>(); | 68 return scoped_ptr<ResourceHost>(); |
58 } | 69 } |
59 | 70 |
| 71 const ppapi::PpapiPermissions& |
| 72 ContentBrowserPepperHostFactory::GetPermissions() const { |
| 73 return host_->GetPpapiHost()->permissions(); |
| 74 } |
| 75 |
60 } // namespace content | 76 } // namespace content |
OLD | NEW |