Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(306)

Side by Side Diff: content/browser/renderer_host/pepper/content_browser_pepper_host_factory.cc

Issue 16959005: Implement PPB_UDPSocket_Dev: part 2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changes in response to Cris and Bill's suggestions. Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_flash_file_message_filter. h" 9 #include "content/browser/renderer_host/pepper/pepper_flash_file_message_filter. 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_mess age_filter.h" 11 #include "content/browser/renderer_host/pepper/pepper_host_resolver_private_mess age_filter.h"
12 #include "content/browser/renderer_host/pepper/pepper_print_settings_manager.h" 12 #include "content/browser/renderer_host/pepper/pepper_print_settings_manager.h"
13 #include "content/browser/renderer_host/pepper/pepper_printing_host.h" 13 #include "content/browser/renderer_host/pepper/pepper_printing_host.h"
14 #include "content/browser/renderer_host/pepper/pepper_truetype_font_list_host.h" 14 #include "content/browser/renderer_host/pepper/pepper_truetype_font_list_host.h"
15 #include "content/browser/renderer_host/pepper/pepper_udp_socket_private_message _filter.h" 15 #include "content/browser/renderer_host/pepper/pepper_udp_socket_message_filter. h"
16 #include "ppapi/host/message_filter_host.h" 16 #include "ppapi/host/message_filter_host.h"
17 #include "ppapi/host/ppapi_host.h" 17 #include "ppapi/host/ppapi_host.h"
18 #include "ppapi/host/resource_host.h" 18 #include "ppapi/host/resource_host.h"
19 #include "ppapi/proxy/ppapi_messages.h" 19 #include "ppapi/proxy/ppapi_messages.h"
20 #include "ppapi/shared_impl/ppapi_permissions.h" 20 #include "ppapi/shared_impl/ppapi_permissions.h"
21 21
22 using ppapi::host::MessageFilterHost; 22 using ppapi::host::MessageFilterHost;
23 using ppapi::host::ResourceHost; 23 using ppapi::host::ResourceHost;
24 using ppapi::host::ResourceMessageFilter; 24 using ppapi::host::ResourceMessageFilter;
25 25
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 scoped_ptr<PepperPrintSettingsManager> manager( 58 scoped_ptr<PepperPrintSettingsManager> manager(
59 new PepperPrintSettingsManagerImpl()); 59 new PepperPrintSettingsManagerImpl());
60 return scoped_ptr<ResourceHost>(new PepperPrintingHost( 60 return scoped_ptr<ResourceHost>(new PepperPrintingHost(
61 host_->GetPpapiHost(), instance, 61 host_->GetPpapiHost(), instance,
62 params.pp_resource(), manager.Pass())); 62 params.pp_resource(), manager.Pass()));
63 } 63 }
64 case PpapiHostMsg_TrueTypeFontSingleton_Create::ID: { 64 case PpapiHostMsg_TrueTypeFontSingleton_Create::ID: {
65 return scoped_ptr<ResourceHost>(new PepperTrueTypeFontListHost( 65 return scoped_ptr<ResourceHost>(new PepperTrueTypeFontListHost(
66 host_, instance, params.pp_resource())); 66 host_, instance, params.pp_resource()));
67 } 67 }
68 case PpapiHostMsg_UDPSocket_Create::ID: {
69 scoped_refptr<ResourceMessageFilter> udp_socket(
70 new PepperUDPSocketMessageFilter(host_, instance, false));
71 return scoped_ptr<ResourceHost>(new MessageFilterHost(
72 host_->GetPpapiHost(), instance, params.pp_resource(), udp_socket));
73 }
68 } 74 }
69 } 75 }
70 76
71 // Private interfaces. 77 // Private interfaces.
72 if (GetPermissions().HasPermission(ppapi::PERMISSION_PRIVATE)) { 78 if (GetPermissions().HasPermission(ppapi::PERMISSION_PRIVATE)) {
73 switch (message.type()) { 79 switch (message.type()) {
74 case PpapiHostMsg_BrowserFontSingleton_Create::ID: 80 case PpapiHostMsg_BrowserFontSingleton_Create::ID:
75 return scoped_ptr<ResourceHost>(new PepperBrowserFontSingletonHost( 81 return scoped_ptr<ResourceHost>(new PepperBrowserFontSingletonHost(
76 host_, instance, params.pp_resource())); 82 host_, instance, params.pp_resource()));
77 } 83 }
78 } 84 }
79 85
80 // Permissions for the following interfaces will be checked at the 86 // Permissions for the following interfaces will be checked at the
81 // time of the corresponding instance's methods calls (because 87 // time of the corresponding instance's methods calls (because
82 // permission check can be performed only on the UI 88 // permission check can be performed only on the UI
83 // thread). Currently these interfaces are available only for 89 // thread). Currently these interfaces are available only for
84 // whitelisted apps which may not have access to the other private 90 // whitelisted apps which may not have access to the other private
85 // interfaces. 91 // interfaces.
86 if (message.type() == PpapiHostMsg_HostResolverPrivate_Create::ID) { 92 if (message.type() == PpapiHostMsg_HostResolverPrivate_Create::ID) {
87 scoped_refptr<ResourceMessageFilter> host_resolver( 93 scoped_refptr<ResourceMessageFilter> host_resolver(
88 new PepperHostResolverPrivateMessageFilter(host_, instance)); 94 new PepperHostResolverPrivateMessageFilter(host_, instance));
89 return scoped_ptr<ResourceHost>(new MessageFilterHost( 95 return scoped_ptr<ResourceHost>(new MessageFilterHost(
90 host_->GetPpapiHost(), instance, params.pp_resource(), host_resolver)); 96 host_->GetPpapiHost(), instance, params.pp_resource(), host_resolver));
91 } 97 }
92 if (message.type() == PpapiHostMsg_UDPSocketPrivate_Create::ID) { 98 if (message.type() == PpapiHostMsg_UDPSocket_CreatePrivate::ID) {
93 scoped_refptr<ResourceMessageFilter> udp_socket( 99 scoped_refptr<ResourceMessageFilter> udp_socket(
94 new PepperUDPSocketPrivateMessageFilter(host_, instance)); 100 new PepperUDPSocketMessageFilter(host_, instance, true));
95 return scoped_ptr<ResourceHost>(new MessageFilterHost( 101 return scoped_ptr<ResourceHost>(new MessageFilterHost(
96 host_->GetPpapiHost(), instance, params.pp_resource(), udp_socket)); 102 host_->GetPpapiHost(), instance, params.pp_resource(), udp_socket));
97 } 103 }
98 104
99 // Flash interfaces. 105 // Flash interfaces.
100 if (GetPermissions().HasPermission(ppapi::PERMISSION_FLASH)) { 106 if (GetPermissions().HasPermission(ppapi::PERMISSION_FLASH)) {
101 switch (message.type()) { 107 switch (message.type()) {
102 case PpapiHostMsg_FlashFile_Create::ID: { 108 case PpapiHostMsg_FlashFile_Create::ID: {
103 scoped_refptr<ResourceMessageFilter> file_filter( 109 scoped_refptr<ResourceMessageFilter> file_filter(
104 new PepperFlashFileMessageFilter(instance, host_)); 110 new PepperFlashFileMessageFilter(instance, host_));
105 return scoped_ptr<ResourceHost>(new MessageFilterHost( 111 return scoped_ptr<ResourceHost>(new MessageFilterHost(
106 host_->GetPpapiHost(), instance, params.pp_resource(), 112 host_->GetPpapiHost(), instance, params.pp_resource(),
107 file_filter)); 113 file_filter));
108 } 114 }
109 } 115 }
110 } 116 }
111 117
112 return scoped_ptr<ResourceHost>(); 118 return scoped_ptr<ResourceHost>();
113 } 119 }
114 120
115 const ppapi::PpapiPermissions& 121 const ppapi::PpapiPermissions&
116 ContentBrowserPepperHostFactory::GetPermissions() const { 122 ContentBrowserPepperHostFactory::GetPermissions() const {
117 return host_->GetPpapiHost()->permissions(); 123 return host_->GetPpapiHost()->permissions();
118 } 124 }
119 125
120 } // namespace content 126 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698