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