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_gamepad_host.h" | 8 #include "content/browser/renderer_host/pepper/pepper_gamepad_host.h" |
9 #include "content/browser/renderer_host/pepper/pepper_print_settings_manager.h" | 9 #include "content/browser/renderer_host/pepper/pepper_print_settings_manager.h" |
10 #include "content/browser/renderer_host/pepper/pepper_printing_host.h" | 10 #include "content/browser/renderer_host/pepper/pepper_printing_host.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 ppapi::host::PpapiHost* host, | 27 ppapi::host::PpapiHost* host, |
28 const ppapi::proxy::ResourceMessageCallParams& params, | 28 const ppapi::proxy::ResourceMessageCallParams& params, |
29 PP_Instance instance, | 29 PP_Instance instance, |
30 const IPC::Message& message) { | 30 const IPC::Message& message) { |
31 DCHECK(host == host_->GetPpapiHost()); | 31 DCHECK(host == host_->GetPpapiHost()); |
32 | 32 |
33 // Make sure the plugin is giving us a valid instance for this resource. | 33 // Make sure the plugin is giving us a valid instance for this resource. |
34 if (!host_->IsValidInstance(instance)) | 34 if (!host_->IsValidInstance(instance)) |
35 return scoped_ptr<ResourceHost>(); | 35 return scoped_ptr<ResourceHost>(); |
36 | 36 |
37 // Public interfaces with no permissions required. | 37 // Public interfaces. |
38 switch (message.type()) { | 38 switch (message.type()) { |
39 case PpapiHostMsg_Gamepad_Create::ID: | 39 case PpapiHostMsg_Gamepad_Create::ID: |
40 return scoped_ptr<ResourceHost>(new PepperGamepadHost( | 40 return scoped_ptr<ResourceHost>(new PepperGamepadHost( |
41 host_, instance, params.pp_resource())); | 41 host_, instance, params.pp_resource())); |
42 case PpapiHostMsg_Printing_Create::ID: { | 42 } |
43 scoped_ptr<PepperPrintSettingsManager> manager( | 43 |
44 new PepperPrintSettingsManagerImpl()); | 44 // Dev interfaces. |
45 return scoped_ptr<ResourceHost>(new PepperPrintingHost( | 45 if (host_->GetPpapiHost()->permissions().HasPermission( |
46 host_->GetPpapiHost(), instance, | 46 ppapi::PERMISSION_DEV)) { |
47 params.pp_resource(), manager.Pass())); | 47 switch (message.type()) { |
| 48 case PpapiHostMsg_Printing_Create::ID: { |
| 49 scoped_ptr<PepperPrintSettingsManager> manager( |
| 50 new PepperPrintSettingsManagerImpl()); |
| 51 return scoped_ptr<ResourceHost>(new PepperPrintingHost( |
| 52 host_->GetPpapiHost(), instance, |
| 53 params.pp_resource(), manager.Pass())); |
| 54 } |
48 } | 55 } |
49 } | 56 } |
50 return scoped_ptr<ResourceHost>(); | 57 return scoped_ptr<ResourceHost>(); |
51 } | 58 } |
52 | 59 |
53 } // namespace content | 60 } // namespace content |
OLD | NEW |