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/ppapi_plugin/ppapi_thread.h" | 5 #include "content/ppapi_plugin/ppapi_thread.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 } while (id == 0 || | 218 } while (id == 0 || |
219 plugin_dispatchers_.find(id) != plugin_dispatchers_.end()); | 219 plugin_dispatchers_.find(id) != plugin_dispatchers_.end()); |
220 plugin_dispatchers_[id] = plugin_dispatcher; | 220 plugin_dispatchers_[id] = plugin_dispatcher; |
221 return id; | 221 return id; |
222 } | 222 } |
223 | 223 |
224 void PpapiThread::Unregister(uint32 plugin_dispatcher_id) { | 224 void PpapiThread::Unregister(uint32 plugin_dispatcher_id) { |
225 plugin_dispatchers_.erase(plugin_dispatcher_id); | 225 plugin_dispatchers_.erase(plugin_dispatcher_id); |
226 } | 226 } |
227 | 227 |
228 void PpapiThread::OnLoadPlugin(const FilePath& path, | 228 void PpapiThread::OnLoadPlugin(const base::FilePath& path, |
229 const ppapi::PpapiPermissions& permissions) { | 229 const ppapi::PpapiPermissions& permissions) { |
230 SavePluginName(path); | 230 SavePluginName(path); |
231 | 231 |
232 // This must be set before calling into the plugin so it can get the | 232 // This must be set before calling into the plugin so it can get the |
233 // interfaces it has permission for. | 233 // interfaces it has permission for. |
234 ppapi::proxy::InterfaceList::SetProcessGlobalPermissions(permissions); | 234 ppapi::proxy::InterfaceList::SetProcessGlobalPermissions(permissions); |
235 permissions_ = permissions; | 235 permissions_ = permissions; |
236 | 236 |
237 // Trusted Pepper plugins may be "internal", i.e. built-in to the browser | 237 // Trusted Pepper plugins may be "internal", i.e. built-in to the browser |
238 // binary. If we're being asked to load such a plugin (e.g. the Chromoting | 238 // binary. If we're being asked to load such a plugin (e.g. the Chromoting |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 handle->socket = base::FileDescriptor(dispatcher->TakeRendererFD(), true); | 443 handle->socket = base::FileDescriptor(dispatcher->TakeRendererFD(), true); |
444 if (handle->socket.fd == -1) | 444 if (handle->socket.fd == -1) |
445 return false; | 445 return false; |
446 #endif | 446 #endif |
447 | 447 |
448 // From here, the dispatcher will manage its own lifetime according to the | 448 // From here, the dispatcher will manage its own lifetime according to the |
449 // lifetime of the attached channel. | 449 // lifetime of the attached channel. |
450 return true; | 450 return true; |
451 } | 451 } |
452 | 452 |
453 void PpapiThread::SavePluginName(const FilePath& path) { | 453 void PpapiThread::SavePluginName(const base::FilePath& path) { |
454 ppapi::proxy::PluginGlobals::Get()->set_plugin_name( | 454 ppapi::proxy::PluginGlobals::Get()->set_plugin_name( |
455 path.BaseName().AsUTF8Unsafe()); | 455 path.BaseName().AsUTF8Unsafe()); |
456 | 456 |
457 // plugin() is NULL when in-process. Which is fine, because this is | 457 // plugin() is NULL when in-process. Which is fine, because this is |
458 // just a hook for setting the process name. | 458 // just a hook for setting the process name. |
459 if (GetContentClient()->plugin()) { | 459 if (GetContentClient()->plugin()) { |
460 GetContentClient()->plugin()->PluginProcessStarted( | 460 GetContentClient()->plugin()->PluginProcessStarted( |
461 path.BaseName().RemoveExtension().LossyDisplayName()); | 461 path.BaseName().RemoveExtension().LossyDisplayName()); |
462 } | 462 } |
463 } | 463 } |
464 | 464 |
465 } // namespace content | 465 } // namespace content |
OLD | NEW |