| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 if (strcmp(name, PPB_FLASH_NETCONNECTOR_INTERFACE) == 0) | 341 if (strcmp(name, PPB_FLASH_NETCONNECTOR_INTERFACE) == 0) |
| 334 return ::ppapi::thunk::GetPPB_Flash_NetConnector_Thunk(); | 342 return ::ppapi::thunk::GetPPB_Flash_NetConnector_Thunk(); |
| 335 #endif // ENABLE_FLAPPER_HACKS | 343 #endif // ENABLE_FLAPPER_HACKS |
| 336 | 344 |
| 337 // Only support the testing interface when the command line switch is | 345 // Only support the testing interface when the command line switch is |
| 338 // specified. This allows us to prevent people from (ab)using this interface | 346 // specified. This allows us to prevent people from (ab)using this interface |
| 339 // in production code. | 347 // in production code. |
| 340 if (CommandLine::ForCurrentProcess()->HasSwitch( | 348 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 341 switches::kEnablePepperTesting)) { | 349 switches::kEnablePepperTesting)) { |
| 342 if (strcmp(name, PPB_TESTING_DEV_INTERFACE) == 0 || | 350 if (strcmp(name, PPB_TESTING_DEV_INTERFACE) == 0 || |
| 343 strcmp(name, PPB_TESTING_DEV_INTERFACE_0_7) == 0) { | 351 strcmp(name, PPB_TESTING_DEV_INTERFACE_0_7) == 0 || |
| 352 strcmp(name, PPB_TESTING_DEV_INTERFACE_0_8) == 0) { |
| 344 return &testing_interface; | 353 return &testing_interface; |
| 345 } | 354 } |
| 346 } | 355 } |
| 347 return NULL; | 356 return NULL; |
| 348 } | 357 } |
| 349 | 358 |
| 350 // Gets the PPAPI entry points from the given library and places them into the | 359 // Gets the PPAPI entry points from the given library and places them into the |
| 351 // given structure. Returns true on success. | 360 // given structure. Returns true on success. |
| 352 bool LoadEntryPointsFromLibrary(const base::NativeLibrary& library, | 361 bool LoadEntryPointsFromLibrary(const base::NativeLibrary& library, |
| 353 PluginModule::EntryPoints* entry_points) { | 362 PluginModule::EntryPoints* entry_points) { |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 int retval = entry_points.initialize_module(pp_module(), &GetInterface); | 585 int retval = entry_points.initialize_module(pp_module(), &GetInterface); |
| 577 if (retval != 0) { | 586 if (retval != 0) { |
| 578 LOG(WARNING) << "PPP_InitializeModule returned failure " << retval; | 587 LOG(WARNING) << "PPP_InitializeModule returned failure " << retval; |
| 579 return false; | 588 return false; |
| 580 } | 589 } |
| 581 return true; | 590 return true; |
| 582 } | 591 } |
| 583 | 592 |
| 584 } // namespace ppapi | 593 } // namespace ppapi |
| 585 } // namespace webkit | 594 } // namespace webkit |
| OLD | NEW |