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

Side by Side Diff: content/renderer/pepper/content_renderer_pepper_host_factory.cc

Issue 11308332: Fix Graphics2D in NaCl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comment Created 8 years 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
« no previous file with comments | « no previous file | ppapi/proxy/ppapi_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/renderer/pepper/content_renderer_pepper_host_factory.h" 5 #include "content/renderer/pepper/content_renderer_pepper_host_factory.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/renderer/pepper/pepper_audio_input_host.h" 8 #include "content/renderer/pepper/pepper_audio_input_host.h"
9 #include "content/renderer/pepper/pepper_file_chooser_host.h" 9 #include "content/renderer/pepper/pepper_file_chooser_host.h"
10 #include "content/renderer/pepper/pepper_flash_clipboard_host.h" 10 #include "content/renderer/pepper/pepper_flash_clipboard_host.h"
(...skipping 23 matching lines...) Expand all
34 PP_Instance instance, 34 PP_Instance instance,
35 const IPC::Message& message) { 35 const IPC::Message& message) {
36 DCHECK(host == host_->GetPpapiHost()); 36 DCHECK(host == host_->GetPpapiHost());
37 37
38 // Make sure the plugin is giving us a valid instance for this resource. 38 // Make sure the plugin is giving us a valid instance for this resource.
39 if (!host_->IsValidInstance(instance)) 39 if (!host_->IsValidInstance(instance))
40 return scoped_ptr<ResourceHost>(); 40 return scoped_ptr<ResourceHost>();
41 41
42 // Public interfaces. 42 // Public interfaces.
43 switch (message.type()) { 43 switch (message.type()) {
44 case PpapiHostMsg_Graphics2D_Create::ID: {
45 PpapiHostMsg_Graphics2D_Create::Schema::Param msg_params;
46 if (!PpapiHostMsg_Graphics2D_Create::Read(&message, &msg_params)) {
47 NOTREACHED();
48 return scoped_ptr<ResourceHost>();
49 }
50 return scoped_ptr<ResourceHost>(
51 PepperGraphics2DHost::Create(host_, instance, params.pp_resource(),
52 msg_params.a /* PP_Size */,
53 msg_params.b /* PP_Bool */));
54 }
44 case PpapiHostMsg_WebSocket_Create::ID: 55 case PpapiHostMsg_WebSocket_Create::ID:
45 return scoped_ptr<ResourceHost>(new PepperWebSocketHost( 56 return scoped_ptr<ResourceHost>(new PepperWebSocketHost(
46 host_, instance, params.pp_resource())); 57 host_, instance, params.pp_resource()));
47 } 58 }
48 59
49 // Dev interfaces. 60 // Dev interfaces.
50 if (GetPermissions().HasPermission(ppapi::PERMISSION_DEV)) { 61 if (GetPermissions().HasPermission(ppapi::PERMISSION_DEV)) {
51 switch (message.type()) { 62 switch (message.type()) {
52 case PpapiHostMsg_AudioInput_Create::ID: 63 case PpapiHostMsg_AudioInput_Create::ID:
53 return scoped_ptr<ResourceHost>(new PepperAudioInputHost( 64 return scoped_ptr<ResourceHost>(new PepperAudioInputHost(
54 host_, instance, params.pp_resource())); 65 host_, instance, params.pp_resource()));
55 case PpapiHostMsg_FileChooser_Create::ID: 66 case PpapiHostMsg_FileChooser_Create::ID:
56 return scoped_ptr<ResourceHost>(new PepperFileChooserHost( 67 return scoped_ptr<ResourceHost>(new PepperFileChooserHost(
57 host_, instance, params.pp_resource())); 68 host_, instance, params.pp_resource()));
58 case PpapiHostMsg_Graphics2D_Create::ID: {
59 PpapiHostMsg_Graphics2D_Create::Schema::Param msg_params;
60 if (!PpapiHostMsg_Graphics2D_Create::Read(&message, &msg_params)) {
61 NOTREACHED();
62 return scoped_ptr<ResourceHost>();
63 }
64 return scoped_ptr<ResourceHost>(
65 PepperGraphics2DHost::Create(host_, instance, params.pp_resource(),
66 msg_params.a /* PP_Size */,
67 msg_params.b /* PP_Bool */));
68 }
69 case PpapiHostMsg_VideoCapture_Create::ID: { 69 case PpapiHostMsg_VideoCapture_Create::ID: {
70 PepperVideoCaptureHost* host = new PepperVideoCaptureHost( 70 PepperVideoCaptureHost* host = new PepperVideoCaptureHost(
71 host_, instance, params.pp_resource()); 71 host_, instance, params.pp_resource());
72 if (!host->Init()) { 72 if (!host->Init()) {
73 delete host; 73 delete host;
74 return scoped_ptr<ResourceHost>(); 74 return scoped_ptr<ResourceHost>();
75 } 75 }
76 return scoped_ptr<ResourceHost>(host); 76 return scoped_ptr<ResourceHost>(host);
77 } 77 }
78 } 78 }
(...skipping 13 matching lines...) Expand all
92 92
93 return scoped_ptr<ResourceHost>(); 93 return scoped_ptr<ResourceHost>();
94 } 94 }
95 95
96 const ppapi::PpapiPermissions& 96 const ppapi::PpapiPermissions&
97 ContentRendererPepperHostFactory::GetPermissions() const { 97 ContentRendererPepperHostFactory::GetPermissions() const {
98 return host_->GetPpapiHost()->permissions(); 98 return host_->GetPpapiHost()->permissions();
99 } 99 }
100 100
101 } // namespace content 101 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | ppapi/proxy/ppapi_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698