Chromium Code Reviews| 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_browser_host.h" | 8 #include "content/browser/renderer_host/pepper/pepper_flash_browser_host.h" |
| 9 #include "content/browser/renderer_host/pepper/pepper_flash_file_host.h" | 9 #include "content/browser/renderer_host/pepper/pepper_flash_file_host.h" |
| 10 #include "content/browser/renderer_host/pepper/pepper_gamepad_host.h" | 10 #include "content/browser/renderer_host/pepper/pepper_gamepad_host.h" |
| 11 #include "content/browser/renderer_host/pepper/pepper_host_resolver_private_host .h" | |
| 11 #include "content/browser/renderer_host/pepper/pepper_print_settings_manager.h" | 12 #include "content/browser/renderer_host/pepper/pepper_print_settings_manager.h" |
| 12 #include "content/browser/renderer_host/pepper/pepper_printing_host.h" | 13 #include "content/browser/renderer_host/pepper/pepper_printing_host.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 #include "ppapi/shared_impl/ppapi_permissions.h" | 16 #include "ppapi/shared_impl/ppapi_permissions.h" |
| 16 | 17 |
| 17 using ppapi::host::ResourceHost; | 18 using ppapi::host::ResourceHost; |
| 18 | 19 |
| 19 namespace content { | 20 namespace content { |
| 20 | 21 |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 37 if (!host_->IsValidInstance(instance)) | 38 if (!host_->IsValidInstance(instance)) |
| 38 return scoped_ptr<ResourceHost>(); | 39 return scoped_ptr<ResourceHost>(); |
| 39 | 40 |
| 40 // Public interfaces. | 41 // Public interfaces. |
| 41 switch (message.type()) { | 42 switch (message.type()) { |
| 42 case PpapiHostMsg_Gamepad_Create::ID: | 43 case PpapiHostMsg_Gamepad_Create::ID: |
| 43 return scoped_ptr<ResourceHost>(new PepperGamepadHost( | 44 return scoped_ptr<ResourceHost>(new PepperGamepadHost( |
| 44 host_, instance, params.pp_resource())); | 45 host_, instance, params.pp_resource())); |
| 45 } | 46 } |
| 46 | 47 |
| 48 // Private interfaces. | |
| 49 if (host_->GetPpapiHost()->permissions().HasPermission( | |
|
yzshen1
2012/12/20 20:00:20
Now that there is a GetPermissions() method, pleas
ygorshenin1
2012/12/21 12:53:26
Done.
| |
| 50 ppapi::PERMISSION_PRIVATE) || | |
| 51 message.type() == PpapiHostMsg_HostResolverPrivate_Create::ID) { | |
|
yzshen1
2012/12/20 20:00:20
Adding a comment about why we need an '||' here wo
ygorshenin1
2012/12/21 12:53:26
Done.
I added code that checks for a plugin that
| |
| 52 switch (message.type()) { | |
| 53 case PpapiHostMsg_HostResolverPrivate_Create::ID: | |
| 54 return scoped_ptr<ResourceHost>(new PepperHostResolverPrivateHost( | |
| 55 host_, instance, params.pp_resource())); | |
| 56 } | |
| 57 } | |
| 58 | |
| 47 // Dev interfaces. | 59 // Dev interfaces. |
| 48 if (GetPermissions().HasPermission(ppapi::PERMISSION_DEV)) { | 60 if (GetPermissions().HasPermission(ppapi::PERMISSION_DEV)) { |
| 49 switch (message.type()) { | 61 switch (message.type()) { |
| 50 case PpapiHostMsg_Printing_Create::ID: { | 62 case PpapiHostMsg_Printing_Create::ID: { |
| 51 scoped_ptr<PepperPrintSettingsManager> manager( | 63 scoped_ptr<PepperPrintSettingsManager> manager( |
| 52 new PepperPrintSettingsManagerImpl()); | 64 new PepperPrintSettingsManagerImpl()); |
| 53 return scoped_ptr<ResourceHost>(new PepperPrintingHost( | 65 return scoped_ptr<ResourceHost>(new PepperPrintingHost( |
| 54 host_->GetPpapiHost(), instance, | 66 host_->GetPpapiHost(), instance, |
| 55 params.pp_resource(), manager.Pass())); | 67 params.pp_resource(), manager.Pass())); |
| 56 } | 68 } |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 71 | 83 |
| 72 return scoped_ptr<ResourceHost>(); | 84 return scoped_ptr<ResourceHost>(); |
| 73 } | 85 } |
| 74 | 86 |
| 75 const ppapi::PpapiPermissions& | 87 const ppapi::PpapiPermissions& |
| 76 ContentBrowserPepperHostFactory::GetPermissions() const { | 88 ContentBrowserPepperHostFactory::GetPermissions() const { |
| 77 return host_->GetPpapiHost()->permissions(); | 89 return host_->GetPpapiHost()->permissions(); |
| 78 } | 90 } |
| 79 | 91 |
| 80 } // namespace content | 92 } // namespace content |
| OLD | NEW |