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