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/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 "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "content/public/common/content_client.h" | 9 #include "content/public/common/content_client.h" |
10 #include "content/public/renderer/content_renderer_client.h" | 10 #include "content/public/renderer/content_renderer_client.h" |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 host_, instance, params.pp_resource())); | 151 host_, instance, params.pp_resource())); |
152 case PpapiHostMsg_TrueTypeFont_Create::ID: { | 152 case PpapiHostMsg_TrueTypeFont_Create::ID: { |
153 SerializedTrueTypeFontDesc desc; | 153 SerializedTrueTypeFontDesc desc; |
154 if (!UnpackMessage<PpapiHostMsg_TrueTypeFont_Create>(message, | 154 if (!UnpackMessage<PpapiHostMsg_TrueTypeFont_Create>(message, |
155 &desc)) { | 155 &desc)) { |
156 NOTREACHED(); | 156 NOTREACHED(); |
157 return scoped_ptr<ResourceHost>(); | 157 return scoped_ptr<ResourceHost>(); |
158 } | 158 } |
159 // Check that the family name is valid UTF-8 before passing it to the | 159 // Check that the family name is valid UTF-8 before passing it to the |
160 // host OS. | 160 // host OS. |
161 if (IsStringUTF8(desc.family)) { | 161 if (base::IsStringUTF8(desc.family)) { |
162 return scoped_ptr<ResourceHost>(new PepperTrueTypeFontHost( | 162 return scoped_ptr<ResourceHost>(new PepperTrueTypeFontHost( |
163 host_, instance, params.pp_resource(), desc)); | 163 host_, instance, params.pp_resource(), desc)); |
164 } | 164 } |
165 break; // Drop through and return null host. | 165 break; // Drop through and return null host. |
166 } | 166 } |
167 case PpapiHostMsg_VideoCapture_Create::ID: { | 167 case PpapiHostMsg_VideoCapture_Create::ID: { |
168 PepperVideoCaptureHost* host = new PepperVideoCaptureHost( | 168 PepperVideoCaptureHost* host = new PepperVideoCaptureHost( |
169 host_, instance, params.pp_resource()); | 169 host_, instance, params.pp_resource()); |
170 if (!host->Init()) { | 170 if (!host->Init()) { |
171 delete host; | 171 delete host; |
172 return scoped_ptr<ResourceHost>(); | 172 return scoped_ptr<ResourceHost>(); |
173 } | 173 } |
174 return scoped_ptr<ResourceHost>(host); | 174 return scoped_ptr<ResourceHost>(host); |
175 } | 175 } |
176 } | 176 } |
177 } | 177 } |
178 | 178 |
179 return scoped_ptr<ResourceHost>(); | 179 return scoped_ptr<ResourceHost>(); |
180 } | 180 } |
181 | 181 |
182 const ppapi::PpapiPermissions& | 182 const ppapi::PpapiPermissions& |
183 ContentRendererPepperHostFactory::GetPermissions() const { | 183 ContentRendererPepperHostFactory::GetPermissions() const { |
184 return host_->GetPpapiHost()->permissions(); | 184 return host_->GetPpapiHost()->permissions(); |
185 } | 185 } |
186 | 186 |
187 } // namespace content | 187 } // namespace content |
OLD | NEW |