OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/plugins/ppapi/plugin_module.h" | 5 #include "webkit/plugins/ppapi/plugin_module.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 return; | 232 return; |
233 | 233 |
234 EnterResource<PPB_InputEvent_API> enter(input_event, false); | 234 EnterResource<PPB_InputEvent_API> enter(input_event, false); |
235 if (enter.failed()) | 235 if (enter.failed()) |
236 return; | 236 return; |
237 | 237 |
238 const InputEventData& input_event_data = enter.object()->GetInputEventData(); | 238 const InputEventData& input_event_data = enter.object()->GetInputEventData(); |
239 plugin_instance->SimulateInputEvent(input_event_data); | 239 plugin_instance->SimulateInputEvent(input_event_data); |
240 } | 240 } |
241 | 241 |
| 242 PP_Var GetDocumentURL(PP_Instance instance, PP_URLComponents_Dev* components) { |
| 243 PluginInstance* plugin_instance = host_globals->GetInstance(instance); |
| 244 if (!plugin_instance) |
| 245 return PP_MakeUndefined(); |
| 246 return plugin_instance->GetDocumentURL(instance, components); |
| 247 } |
| 248 |
242 const PPB_Testing_Dev testing_interface = { | 249 const PPB_Testing_Dev testing_interface = { |
243 &ReadImageData, | 250 &ReadImageData, |
244 &RunMessageLoop, | 251 &RunMessageLoop, |
245 &QuitMessageLoop, | 252 &QuitMessageLoop, |
246 &GetLiveObjectsForInstance, | 253 &GetLiveObjectsForInstance, |
247 &IsOutOfProcess, | 254 &IsOutOfProcess, |
248 &SimulateInputEvent | 255 &SimulateInputEvent, |
| 256 &GetDocumentURL |
249 }; | 257 }; |
250 | 258 |
251 // GetInterface ---------------------------------------------------------------- | 259 // GetInterface ---------------------------------------------------------------- |
252 | 260 |
253 const void* GetInterface(const char* name) { | 261 const void* GetInterface(const char* name) { |
254 // All interfaces should be used on the main thread. | 262 // All interfaces should be used on the main thread. |
255 CHECK(IsMainThread()); | 263 CHECK(IsMainThread()); |
256 | 264 |
257 // Allow custom interface factories first stab at the GetInterface call. | 265 // Allow custom interface factories first stab at the GetInterface call. |
258 const void* custom_interface = | 266 const void* custom_interface = |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 if (strcmp(name, PPB_FLASH_NETCONNECTOR_INTERFACE) == 0) | 339 if (strcmp(name, PPB_FLASH_NETCONNECTOR_INTERFACE) == 0) |
332 return ::ppapi::thunk::GetPPB_Flash_NetConnector_Thunk(); | 340 return ::ppapi::thunk::GetPPB_Flash_NetConnector_Thunk(); |
333 #endif // ENABLE_FLAPPER_HACKS | 341 #endif // ENABLE_FLAPPER_HACKS |
334 | 342 |
335 // Only support the testing interface when the command line switch is | 343 // Only support the testing interface when the command line switch is |
336 // specified. This allows us to prevent people from (ab)using this interface | 344 // specified. This allows us to prevent people from (ab)using this interface |
337 // in production code. | 345 // in production code. |
338 if (CommandLine::ForCurrentProcess()->HasSwitch( | 346 if (CommandLine::ForCurrentProcess()->HasSwitch( |
339 switches::kEnablePepperTesting)) { | 347 switches::kEnablePepperTesting)) { |
340 if (strcmp(name, PPB_TESTING_DEV_INTERFACE) == 0 || | 348 if (strcmp(name, PPB_TESTING_DEV_INTERFACE) == 0 || |
341 strcmp(name, PPB_TESTING_DEV_INTERFACE_0_7) == 0) { | 349 strcmp(name, PPB_TESTING_DEV_INTERFACE_0_7) == 0 || |
| 350 strcmp(name, PPB_TESTING_DEV_INTERFACE_0_8) == 0) { |
342 return &testing_interface; | 351 return &testing_interface; |
343 } | 352 } |
344 } | 353 } |
345 return NULL; | 354 return NULL; |
346 } | 355 } |
347 | 356 |
348 // Gets the PPAPI entry points from the given library and places them into the | 357 // Gets the PPAPI entry points from the given library and places them into the |
349 // given structure. Returns true on success. | 358 // given structure. Returns true on success. |
350 bool LoadEntryPointsFromLibrary(const base::NativeLibrary& library, | 359 bool LoadEntryPointsFromLibrary(const base::NativeLibrary& library, |
351 PluginModule::EntryPoints* entry_points) { | 360 PluginModule::EntryPoints* entry_points) { |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 int retval = entry_points.initialize_module(pp_module(), &GetInterface); | 583 int retval = entry_points.initialize_module(pp_module(), &GetInterface); |
575 if (retval != 0) { | 584 if (retval != 0) { |
576 LOG(WARNING) << "PPP_InitializeModule returned failure " << retval; | 585 LOG(WARNING) << "PPP_InitializeModule returned failure " << retval; |
577 return false; | 586 return false; |
578 } | 587 } |
579 return true; | 588 return true; |
580 } | 589 } |
581 | 590 |
582 } // namespace ppapi | 591 } // namespace ppapi |
583 } // namespace webkit | 592 } // namespace webkit |
OLD | NEW |