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_browser_font_singleton_hos
t.h" | 8 #include "content/browser/renderer_host/pepper/pepper_browser_font_singleton_hos
t.h" |
9 #include "content/browser/renderer_host/pepper/pepper_file_ref_host.h" | 9 #include "content/browser/renderer_host/pepper/pepper_file_ref_host.h" |
10 #include "content/browser/renderer_host/pepper/pepper_file_system_browser_host.h
" | 10 #include "content/browser/renderer_host/pepper/pepper_file_system_browser_host.h
" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 PP_Instance instance, | 43 PP_Instance instance, |
44 const IPC::Message& message) { | 44 const IPC::Message& message) { |
45 DCHECK(host == host_->GetPpapiHost()); | 45 DCHECK(host == host_->GetPpapiHost()); |
46 | 46 |
47 // Make sure the plugin is giving us a valid instance for this resource. | 47 // Make sure the plugin is giving us a valid instance for this resource. |
48 if (!host_->IsValidInstance(instance)) | 48 if (!host_->IsValidInstance(instance)) |
49 return scoped_ptr<ResourceHost>(); | 49 return scoped_ptr<ResourceHost>(); |
50 | 50 |
51 // Public interfaces. | 51 // Public interfaces. |
52 switch (message.type()) { | 52 switch (message.type()) { |
| 53 case PpapiHostMsg_FileRef_CreateInternal::ID: { |
| 54 PP_Resource file_system; |
| 55 std::string internal_path; |
| 56 if (!UnpackMessage<PpapiHostMsg_FileRef_CreateInternal>( |
| 57 message, &file_system, &internal_path)) { |
| 58 NOTREACHED(); |
| 59 return scoped_ptr<ResourceHost>(); |
| 60 } |
| 61 return scoped_ptr<ResourceHost>(new PepperFileRefHost( |
| 62 host_, instance, params.pp_resource(), file_system, internal_path)); |
| 63 } |
53 case PpapiHostMsg_FileSystem_Create::ID: { | 64 case PpapiHostMsg_FileSystem_Create::ID: { |
54 PP_FileSystemType file_system_type; | 65 PP_FileSystemType file_system_type; |
55 if (!ppapi::UnpackMessage<PpapiHostMsg_FileSystem_Create>(message, | 66 if (!ppapi::UnpackMessage<PpapiHostMsg_FileSystem_Create>(message, |
56 &file_system_type)) { | 67 &file_system_type)) { |
57 NOTREACHED(); | 68 NOTREACHED(); |
58 return scoped_ptr<ResourceHost>(); | 69 return scoped_ptr<ResourceHost>(); |
59 } | 70 } |
60 return scoped_ptr<ResourceHost>(new PepperFileSystemBrowserHost( | 71 return scoped_ptr<ResourceHost>(new PepperFileSystemBrowserHost( |
61 host_, instance, params.pp_resource(), file_system_type)); | 72 host_, instance, params.pp_resource(), file_system_type)); |
62 } | 73 } |
63 case PpapiHostMsg_Gamepad_Create::ID: | 74 case PpapiHostMsg_Gamepad_Create::ID: |
64 return scoped_ptr<ResourceHost>(new PepperGamepadHost( | 75 return scoped_ptr<ResourceHost>(new PepperGamepadHost( |
65 host_, instance, params.pp_resource())); | 76 host_, instance, params.pp_resource())); |
66 case PpapiHostMsg_FileRef_CreateInternal::ID: { | 77 case PpapiHostMsg_NetworkProxy_Create::ID: { |
67 PP_Resource file_system; | 78 return scoped_ptr<ResourceHost>(new PepperNetworkProxyHost( |
68 std::string internal_path; | 79 host_, instance, params.pp_resource())); |
69 if (!UnpackMessage<PpapiHostMsg_FileRef_CreateInternal>( | |
70 message, &file_system, &internal_path)) { | |
71 NOTREACHED(); | |
72 return scoped_ptr<ResourceHost>(); | |
73 } | |
74 return scoped_ptr<ResourceHost>(new PepperFileRefHost( | |
75 host_, instance, params.pp_resource(), file_system, internal_path)); | |
76 } | 80 } |
77 } | 81 } |
78 | 82 |
79 // Dev interfaces. | 83 // Dev interfaces. |
80 if (GetPermissions().HasPermission(ppapi::PERMISSION_DEV)) { | 84 if (GetPermissions().HasPermission(ppapi::PERMISSION_DEV)) { |
81 switch (message.type()) { | 85 switch (message.type()) { |
82 case PpapiHostMsg_NetworkProxy_Create::ID: { | |
83 return scoped_ptr<ResourceHost>(new PepperNetworkProxyHost( | |
84 host_, instance, params.pp_resource())); | |
85 } | |
86 case PpapiHostMsg_HostResolver_Create::ID: { | 86 case PpapiHostMsg_HostResolver_Create::ID: { |
87 scoped_refptr<ResourceMessageFilter> host_resolver( | 87 scoped_refptr<ResourceMessageFilter> host_resolver( |
88 new PepperHostResolverMessageFilter(host_, instance, false)); | 88 new PepperHostResolverMessageFilter(host_, instance, false)); |
89 return scoped_ptr<ResourceHost>(new MessageFilterHost( | 89 return scoped_ptr<ResourceHost>(new MessageFilterHost( |
90 host_->GetPpapiHost(), instance, params.pp_resource(), | 90 host_->GetPpapiHost(), instance, params.pp_resource(), |
91 host_resolver)); | 91 host_resolver)); |
92 } | 92 } |
93 case PpapiHostMsg_Printing_Create::ID: { | 93 case PpapiHostMsg_Printing_Create::ID: { |
94 scoped_ptr<PepperPrintSettingsManager> manager( | 94 scoped_ptr<PepperPrintSettingsManager> manager( |
95 new PepperPrintSettingsManagerImpl()); | 95 new PepperPrintSettingsManagerImpl()); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 | 153 |
154 return scoped_ptr<ResourceHost>(); | 154 return scoped_ptr<ResourceHost>(); |
155 } | 155 } |
156 | 156 |
157 const ppapi::PpapiPermissions& | 157 const ppapi::PpapiPermissions& |
158 ContentBrowserPepperHostFactory::GetPermissions() const { | 158 ContentBrowserPepperHostFactory::GetPermissions() const { |
159 return host_->GetPpapiHost()->permissions(); | 159 return host_->GetPpapiHost()->permissions(); |
160 } | 160 } |
161 | 161 |
162 } // namespace content | 162 } // namespace content |
OLD | NEW |