Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "webkit/glue/plugins/pepper_plugin_module.h" | 5 #include "webkit/glue/plugins/pepper_plugin_module.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/command_line.h" | |
| 9 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
| 10 #include "base/logging.h" | 11 #include "base/logging.h" |
| 11 #include "base/scoped_ptr.h" | 12 #include "base/scoped_ptr.h" |
| 12 #include "base/time.h" | 13 #include "base/time.h" |
| 13 #include "third_party/ppapi/c/ppb_core.h" | 14 #include "third_party/ppapi/c/ppb_core.h" |
| 14 #include "third_party/ppapi/c/ppb_device_context_2d.h" | 15 #include "third_party/ppapi/c/ppb_device_context_2d.h" |
| 15 #include "third_party/ppapi/c/ppb_image_data.h" | 16 #include "third_party/ppapi/c/ppb_image_data.h" |
| 16 #include "third_party/ppapi/c/ppb_instance.h" | 17 #include "third_party/ppapi/c/ppb_instance.h" |
| 17 #include "third_party/ppapi/c/ppb_testing.h" | 18 #include "third_party/ppapi/c/ppb_testing.h" |
| 18 #include "third_party/ppapi/c/ppb_var.h" | 19 #include "third_party/ppapi/c/ppb_var.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 119 if (strcmp(name, PPB_CORE_INTERFACE) == 0) | 120 if (strcmp(name, PPB_CORE_INTERFACE) == 0) |
| 120 return &core_interface; | 121 return &core_interface; |
| 121 if (strcmp(name, PPB_VAR_INTERFACE) == 0) | 122 if (strcmp(name, PPB_VAR_INTERFACE) == 0) |
| 122 return GetVarInterface(); | 123 return GetVarInterface(); |
| 123 if (strcmp(name, PPB_INSTANCE_INTERFACE) == 0) | 124 if (strcmp(name, PPB_INSTANCE_INTERFACE) == 0) |
| 124 return PluginInstance::GetInterface(); | 125 return PluginInstance::GetInterface(); |
| 125 if (strcmp(name, PPB_IMAGEDATA_INTERFACE) == 0) | 126 if (strcmp(name, PPB_IMAGEDATA_INTERFACE) == 0) |
| 126 return ImageData::GetInterface(); | 127 return ImageData::GetInterface(); |
| 127 if (strcmp(name, PPB_DEVICECONTEXT2D_INTERFACE) == 0) | 128 if (strcmp(name, PPB_DEVICECONTEXT2D_INTERFACE) == 0) |
| 128 return DeviceContext2D::GetInterface(); | 129 return DeviceContext2D::GetInterface(); |
| 129 if (strcmp(name, PPB_TESTING_INTERFACE) == 0) | 130 |
| 130 return &testing_interface; | 131 // Only support the testing interface when the command line switch is |
| 132 // specified. This allows us to prevent people from (ab)using this interface | |
| 133 // in production code. | |
| 134 if (strcmp(name, PPB_TESTING_INTERFACE) == 0) { | |
| 135 if (CommandLine::ForCurrentProcess()->HasSwitch("enable-pepper-testing")) | |
|
Nico
2011/08/30 20:22:23
Why not kEnablePepperTesting?
(Asking because I w
brettw
2011/08/30 23:10:41
I think at the time of this patch there was no sha
| |
| 136 return &testing_interface; | |
| 137 } | |
| 131 return NULL; | 138 return NULL; |
| 132 } | 139 } |
| 133 | 140 |
| 134 } // namespace | 141 } // namespace |
| 135 | 142 |
| 136 PluginModule::PluginModule(const FilePath& filename) | 143 PluginModule::PluginModule(const FilePath& filename) |
| 137 : filename_(filename), | 144 : filename_(filename), |
| 138 initialized_(false), | 145 initialized_(false), |
| 139 library_(0), | 146 library_(0), |
| 140 ppp_get_interface_(NULL) { | 147 ppp_get_interface_(NULL) { |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 246 | 253 |
| 247 void PluginModule::InstanceCreated(PluginInstance* instance) { | 254 void PluginModule::InstanceCreated(PluginInstance* instance) { |
| 248 instances_.insert(instance); | 255 instances_.insert(instance); |
| 249 } | 256 } |
| 250 | 257 |
| 251 void PluginModule::InstanceDeleted(PluginInstance* instance) { | 258 void PluginModule::InstanceDeleted(PluginInstance* instance) { |
| 252 instances_.erase(instance); | 259 instances_.erase(instance); |
| 253 } | 260 } |
| 254 | 261 |
| 255 } // namespace pepper | 262 } // namespace pepper |
| OLD | NEW |