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

Side by Side Diff: webkit/plugins/ppapi/ppapi_plugin_instance.h

Issue 7285010: Implement an input event resource. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 months 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 #ifndef WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_
6 #define WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ 6 #define WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
17 #include "base/string16.h" 17 #include "base/string16.h"
18 #include "googleurl/src/gurl.h" 18 #include "googleurl/src/gurl.h"
19 #include "ppapi/c/dev/pp_cursor_type_dev.h" 19 #include "ppapi/c/dev/pp_cursor_type_dev.h"
20 #include "ppapi/c/dev/ppp_graphics_3d_dev.h" 20 #include "ppapi/c/dev/ppp_graphics_3d_dev.h"
21 #include "ppapi/c/dev/ppp_printing_dev.h" 21 #include "ppapi/c/dev/ppp_printing_dev.h"
22 #include "ppapi/c/pp_instance.h" 22 #include "ppapi/c/pp_instance.h"
23 #include "ppapi/c/pp_resource.h" 23 #include "ppapi/c/pp_resource.h"
24 #include "ppapi/c/pp_var.h" 24 #include "ppapi/c/pp_var.h"
25 #include "ppapi/c/ppp_instance.h" 25 #include "ppapi/c/ppp_instance.h"
26 #include "ppapi/shared_impl/function_group_base.h" 26 #include "ppapi/shared_impl/function_group_base.h"
27 #include "ppapi/shared_impl/instance_impl.h"
27 #include "ppapi/thunk/ppb_instance_api.h" 28 #include "ppapi/thunk/ppb_instance_api.h"
28 #include "third_party/skia/include/core/SkBitmap.h" 29 #include "third_party/skia/include/core/SkBitmap.h"
29 #include "third_party/skia/include/core/SkRefCnt.h" 30 #include "third_party/skia/include/core/SkRefCnt.h"
30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCanvas.h" 31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCanvas.h"
31 #include "ui/gfx/rect.h" 32 #include "ui/gfx/rect.h"
32 #include "webkit/plugins/ppapi/plugin_delegate.h" 33 #include "webkit/plugins/ppapi/plugin_delegate.h"
33 34
34 typedef struct NPObject NPObject; 35 typedef struct NPObject NPObject;
35 struct PP_Var; 36 struct PP_Var;
36 struct PPB_Messaging; 37 struct PPB_Messaging;
37 struct PPB_Zoom_Dev; 38 struct PPB_Zoom_Dev;
38 struct PPP_Find_Dev; 39 struct PPP_Find_Dev;
40 struct PPP_InputEvent;
39 struct PPP_Instance_Private; 41 struct PPP_Instance_Private;
40 struct PPP_Messaging; 42 struct PPP_Messaging;
41 struct PPP_Pdf; 43 struct PPP_Pdf;
42 struct PPP_Selection_Dev; 44 struct PPP_Selection_Dev;
43 struct PPP_Zoom_Dev; 45 struct PPP_Zoom_Dev;
44 46
45 class SkBitmap; 47 class SkBitmap;
46 class TransportDIB; 48 class TransportDIB;
47 49
48 namespace gfx { 50 namespace gfx {
(...skipping 21 matching lines...) Expand all
70 class PPB_URLLoader_Impl; 72 class PPB_URLLoader_Impl;
71 class PPB_URLRequestInfo_Impl; 73 class PPB_URLRequestInfo_Impl;
72 class Resource; 74 class Resource;
73 75
74 // Represents one time a plugin appears on one web page. 76 // Represents one time a plugin appears on one web page.
75 // 77 //
76 // Note: to get from a PP_Instance to a PluginInstance*, use the 78 // Note: to get from a PP_Instance to a PluginInstance*, use the
77 // ResourceTracker. 79 // ResourceTracker.
78 class PluginInstance : public base::RefCounted<PluginInstance>, 80 class PluginInstance : public base::RefCounted<PluginInstance>,
79 public ::ppapi::FunctionGroupBase, 81 public ::ppapi::FunctionGroupBase,
80 public ::ppapi::thunk::PPB_Instance_FunctionAPI { 82 public ::ppapi::thunk::PPB_Instance_FunctionAPI,
83 public ::ppapi::InstanceImpl {
81 public: 84 public:
82 struct PPP_Instance_Combined; 85 struct PPP_Instance_Combined;
83 86
84 PluginInstance(PluginDelegate* delegate, 87 PluginInstance(PluginDelegate* delegate,
85 PluginModule* module, 88 PluginModule* module,
86 PPP_Instance_Combined* instance_interface); 89 PPP_Instance_Combined* instance_interface);
87 90
88 // Delete should be called by the WebPlugin before this destructor. 91 // Delete should be called by the WebPlugin before this destructor.
89 virtual ~PluginInstance(); 92 virtual ~PluginInstance();
90 93
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 virtual PP_Bool IsFullFrame(PP_Instance instance) OVERRIDE; 284 virtual PP_Bool IsFullFrame(PP_Instance instance) OVERRIDE;
282 virtual PP_Var GetWindowObject(PP_Instance instance) OVERRIDE; 285 virtual PP_Var GetWindowObject(PP_Instance instance) OVERRIDE;
283 virtual PP_Var GetOwnerElementObject(PP_Instance instance) OVERRIDE; 286 virtual PP_Var GetOwnerElementObject(PP_Instance instance) OVERRIDE;
284 virtual PP_Var ExecuteScript(PP_Instance instance, 287 virtual PP_Var ExecuteScript(PP_Instance instance,
285 PP_Var script, 288 PP_Var script,
286 PP_Var* exception) OVERRIDE; 289 PP_Var* exception) OVERRIDE;
287 virtual PP_Bool IsFullscreen(PP_Instance instance) OVERRIDE; 290 virtual PP_Bool IsFullscreen(PP_Instance instance) OVERRIDE;
288 virtual PP_Bool SetFullscreen(PP_Instance instance, 291 virtual PP_Bool SetFullscreen(PP_Instance instance,
289 PP_Bool fullscreen) OVERRIDE; 292 PP_Bool fullscreen) OVERRIDE;
290 virtual PP_Bool GetScreenSize(PP_Instance instance, PP_Size* size) OVERRIDE; 293 virtual PP_Bool GetScreenSize(PP_Instance instance, PP_Size* size) OVERRIDE;
294 virtual int32_t RequestInputEvents(PP_Instance instance,
295 uint32_t event_classes) OVERRIDE;
296 virtual int32_t RequestFilteringInputEvents(PP_Instance instance,
297 uint32_t event_classes) OVERRIDE;
298 virtual void ClearInputEventRequest(PP_Instance instance,
299 uint32_t event_classes) OVERRIDE;
291 300
292 private: 301 private:
293 bool LoadFindInterface(); 302 bool LoadFindInterface();
303 bool LoadInputEventInterface();
294 bool LoadMessagingInterface(); 304 bool LoadMessagingInterface();
295 bool LoadPdfInterface(); 305 bool LoadPdfInterface();
296 bool LoadSelectionInterface(); 306 bool LoadSelectionInterface();
297 bool LoadPrintInterface(); 307 bool LoadPrintInterface();
298 bool LoadPrivateInterface(); 308 bool LoadPrivateInterface();
299 bool LoadZoomInterface(); 309 bool LoadZoomInterface();
300 310
301 // Determines if we think the plugin has focus, both content area and webkit 311 // Determines if we think the plugin has focus, both content area and webkit
302 // (see has_webkit_focus_ below). 312 // (see has_webkit_focus_ below).
303 bool PluginHasFocus() const; 313 bool PluginHasFocus() const;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 // these values are set to true. 386 // these values are set to true.
377 bool has_webkit_focus_; 387 bool has_webkit_focus_;
378 bool has_content_area_focus_; 388 bool has_content_area_focus_;
379 389
380 // The id of the current find operation, or -1 if none is in process. 390 // The id of the current find operation, or -1 if none is in process.
381 int find_identifier_; 391 int find_identifier_;
382 392
383 // The plugin-provided interfaces. 393 // The plugin-provided interfaces.
384 const PPP_Find_Dev* plugin_find_interface_; 394 const PPP_Find_Dev* plugin_find_interface_;
385 const PPP_Messaging* plugin_messaging_interface_; 395 const PPP_Messaging* plugin_messaging_interface_;
396 const PPP_InputEvent* plugin_input_event_interface_;
397 const PPP_Instance_Private* plugin_private_interface_;
386 const PPP_Pdf* plugin_pdf_interface_; 398 const PPP_Pdf* plugin_pdf_interface_;
387 const PPP_Instance_Private* plugin_private_interface_;
388 const PPP_Selection_Dev* plugin_selection_interface_; 399 const PPP_Selection_Dev* plugin_selection_interface_;
389 const PPP_Zoom_Dev* plugin_zoom_interface_; 400 const PPP_Zoom_Dev* plugin_zoom_interface_;
390 401
391 // A flag to indicate whether we have asked this plugin instance for its 402 // Flags indicating whether we have asked this plugin instance for the
392 // messaging interface, so that we can ask only once. 403 // corresponding intefaces, so that we can ask only once.
dmichael (off chromium) 2011/07/01 20:04:19 intefaces->interfaces
404 bool checked_for_plugin_input_event_interface_;
393 bool checked_for_plugin_messaging_interface_; 405 bool checked_for_plugin_messaging_interface_;
394 406
395 // This is only valid between a successful PrintBegin call and a PrintEnd 407 // This is only valid between a successful PrintBegin call and a PrintEnd
396 // call. 408 // call.
397 PP_PrintSettings_Dev_0_4 current_print_settings_; 409 PP_PrintSettings_Dev_0_4 current_print_settings_;
398 #if defined(OS_MACOSX) 410 #if defined(OS_MACOSX)
399 // On the Mac, when we draw the bitmap to the PDFContext, it seems necessary 411 // On the Mac, when we draw the bitmap to the PDFContext, it seems necessary
400 // to keep the pixels valid until CGContextEndPage is called. We use this 412 // to keep the pixels valid until CGContextEndPage is called. We use this
401 // variable to hold on to the pixels. 413 // variable to hold on to the pixels.
402 scoped_refptr<PPB_ImageData_Impl> last_printed_page_; 414 scoped_refptr<PPB_ImageData_Impl> last_printed_page_;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 SkBitmap* sad_plugin_; 488 SkBitmap* sad_plugin_;
477 489
478 typedef std::set<PluginObject*> PluginObjectSet; 490 typedef std::set<PluginObject*> PluginObjectSet;
479 PluginObjectSet live_plugin_objects_; 491 PluginObjectSet live_plugin_objects_;
480 492
481 // Tracks all live ObjectVars used by this module so we can map NPObjects to 493 // Tracks all live ObjectVars used by this module so we can map NPObjects to
482 // the corresponding object. These are non-owning references. 494 // the corresponding object. These are non-owning references.
483 typedef std::map<NPObject*, ObjectVar*> NPObjectToObjectVarMap; 495 typedef std::map<NPObject*, ObjectVar*> NPObjectToObjectVarMap;
484 NPObjectToObjectVarMap np_object_to_object_var_; 496 NPObjectToObjectVarMap np_object_to_object_var_;
485 497
498 // Classes of events that the plugin has registered for, both for filtering
499 // and not. The bits are PP_INPUTEVENT_CLASS_*.
500 uint32_t input_event_mask_;
501 uint32_t filtered_input_event_mask_;
502
486 DISALLOW_COPY_AND_ASSIGN(PluginInstance); 503 DISALLOW_COPY_AND_ASSIGN(PluginInstance);
487 }; 504 };
488 505
489 } // namespace ppapi 506 } // namespace ppapi
490 } // namespace webkit 507 } // namespace webkit
491 508
492 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ 509 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698