Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(403)

Side by Side Diff: webkit/plugins/ppapi/plugin_module.cc

Issue 8920005: Add TestingInstance::EvalScript method which posts a message that the test page can eval(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 ExecuteScript(PP_Instance instance, PP_Var script, PP_Var* exception) {
243 PluginInstance* plugin_instance = host_globals->GetInstance(instance);
244 if (!plugin_instance) {
245 *exception = PP_MakeUndefined();
246 return PP_MakeUndefined();
247 }
248
249 return plugin_instance->ExecuteScript(instance, script, exception);
250 }
251
242 const PPB_Testing_Dev testing_interface = { 252 const PPB_Testing_Dev testing_interface = {
243 &ReadImageData, 253 &ReadImageData,
244 &RunMessageLoop, 254 &RunMessageLoop,
245 &QuitMessageLoop, 255 &QuitMessageLoop,
246 &GetLiveObjectsForInstance, 256 &GetLiveObjectsForInstance,
247 &IsOutOfProcess, 257 &IsOutOfProcess,
248 &SimulateInputEvent 258 &SimulateInputEvent,
259 &ExecuteScript
249 }; 260 };
250 261
251 // GetInterface ---------------------------------------------------------------- 262 // GetInterface ----------------------------------------------------------------
252 263
253 const void* GetInterface(const char* name) { 264 const void* GetInterface(const char* name) {
254 // All interfaces should be used on the main thread. 265 // All interfaces should be used on the main thread.
255 CHECK(IsMainThread()); 266 CHECK(IsMainThread());
256 267
257 // Allow custom interface factories first stab at the GetInterface call. 268 // Allow custom interface factories first stab at the GetInterface call.
258 const void* custom_interface = 269 const void* custom_interface =
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 if (strcmp(name, PPB_FLASH_NETCONNECTOR_INTERFACE) == 0) 342 if (strcmp(name, PPB_FLASH_NETCONNECTOR_INTERFACE) == 0)
332 return ::ppapi::thunk::GetPPB_Flash_NetConnector_Thunk(); 343 return ::ppapi::thunk::GetPPB_Flash_NetConnector_Thunk();
333 #endif // ENABLE_FLAPPER_HACKS 344 #endif // ENABLE_FLAPPER_HACKS
334 345
335 // Only support the testing interface when the command line switch is 346 // Only support the testing interface when the command line switch is
336 // specified. This allows us to prevent people from (ab)using this interface 347 // specified. This allows us to prevent people from (ab)using this interface
337 // in production code. 348 // in production code.
338 if (CommandLine::ForCurrentProcess()->HasSwitch( 349 if (CommandLine::ForCurrentProcess()->HasSwitch(
339 switches::kEnablePepperTesting)) { 350 switches::kEnablePepperTesting)) {
340 if (strcmp(name, PPB_TESTING_DEV_INTERFACE) == 0 || 351 if (strcmp(name, PPB_TESTING_DEV_INTERFACE) == 0 ||
352 strcmp(name, PPB_TESTING_DEV_INTERFACE_0_8) == 0 ||
341 strcmp(name, PPB_TESTING_DEV_INTERFACE_0_7) == 0) { 353 strcmp(name, PPB_TESTING_DEV_INTERFACE_0_7) == 0) {
342 return &testing_interface; 354 return &testing_interface;
343 } 355 }
344 } 356 }
345 return NULL; 357 return NULL;
346 } 358 }
347 359
348 // Gets the PPAPI entry points from the given library and places them into the 360 // Gets the PPAPI entry points from the given library and places them into the
349 // given structure. Returns true on success. 361 // given structure. Returns true on success.
350 bool LoadEntryPointsFromLibrary(const base::NativeLibrary& library, 362 bool LoadEntryPointsFromLibrary(const base::NativeLibrary& library,
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 int retval = entry_points.initialize_module(pp_module(), &GetInterface); 586 int retval = entry_points.initialize_module(pp_module(), &GetInterface);
575 if (retval != 0) { 587 if (retval != 0) {
576 LOG(WARNING) << "PPP_InitializeModule returned failure " << retval; 588 LOG(WARNING) << "PPP_InitializeModule returned failure " << retval;
577 return false; 589 return false;
578 } 590 }
579 return true; 591 return true;
580 } 592 }
581 593
582 } // namespace ppapi 594 } // namespace ppapi
583 } // namespace webkit 595 } // namespace webkit
OLDNEW
« ppapi/tests/test_input_event.cc ('K') | « ppapi/tests/test_input_event.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698