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

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

Issue 6538028: A proposal for an initial postMessage interface. This will allow JavaScript ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 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>
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 namespace WebKit { 46 namespace WebKit {
47 struct WebCursorInfo; 47 struct WebCursorInfo;
48 class WebInputEvent; 48 class WebInputEvent;
49 class WebPluginContainer; 49 class WebPluginContainer;
50 } 50 }
51 51
52 namespace webkit { 52 namespace webkit {
53 namespace ppapi { 53 namespace ppapi {
54 54
55 class FullscreenContainer; 55 class FullscreenContainer;
56 class MessageChannel;
56 class ObjectVar; 57 class ObjectVar;
57 class PluginDelegate; 58 class PluginDelegate;
58 class PluginModule; 59 class PluginModule;
59 class PluginObject; 60 class PluginObject;
60 class PPB_Graphics2D_Impl; 61 class PPB_Graphics2D_Impl;
61 class PPB_ImageData_Impl; 62 class PPB_ImageData_Impl;
62 class PPB_Surface3D_Impl; 63 class PPB_Surface3D_Impl;
63 class PPB_URLLoader_Impl; 64 class PPB_URLLoader_Impl;
64 class Resource; 65 class Resource;
65 66
(...skipping 11 matching lines...) Expand all
77 static const PPB_Instance* GetInterface(); 78 static const PPB_Instance* GetInterface();
78 79
79 // Returns a pointer to the interface implementing PPB_Find that is 80 // Returns a pointer to the interface implementing PPB_Find that is
80 // exposed to the plugin. 81 // exposed to the plugin.
81 static const PPB_Find_Dev* GetFindInterface(); 82 static const PPB_Find_Dev* GetFindInterface();
82 static const PPB_Fullscreen_Dev* GetFullscreenInterface(); 83 static const PPB_Fullscreen_Dev* GetFullscreenInterface();
83 static const PPB_Zoom_Dev* GetZoomInterface(); 84 static const PPB_Zoom_Dev* GetZoomInterface();
84 85
85 PluginDelegate* delegate() const { return delegate_; } 86 PluginDelegate* delegate() const { return delegate_; }
86 PluginModule* module() const { return module_.get(); } 87 PluginModule* module() const { return module_.get(); }
88 MessageChannel& message_channel() { return *message_channel_; }
87 89
88 WebKit::WebPluginContainer* container() const { return container_; } 90 WebKit::WebPluginContainer* container() const { return container_; }
89 91
90 const gfx::Rect& position() const { return position_; } 92 const gfx::Rect& position() const { return position_; }
91 const gfx::Rect& clip() const { return clip_; } 93 const gfx::Rect& clip() const { return clip_; }
92 94
93 int find_identifier() const { return find_identifier_; } 95 int find_identifier() const { return find_identifier_; }
94 96
95 void set_always_on_top(bool on_top) { always_on_top_ = on_top; } 97 void set_always_on_top(bool on_top) { always_on_top_ = on_top; }
96 98
(...skipping 28 matching lines...) Expand all
125 // Called when the out-of-process plugin implementing this instance crashed. 127 // Called when the out-of-process plugin implementing this instance crashed.
126 void InstanceCrashed(); 128 void InstanceCrashed();
127 129
128 // PPB_Instance implementation. 130 // PPB_Instance implementation.
129 PP_Var GetWindowObject(); 131 PP_Var GetWindowObject();
130 PP_Var GetOwnerElementObject(); 132 PP_Var GetOwnerElementObject();
131 bool BindGraphics(PP_Resource graphics_id); 133 bool BindGraphics(PP_Resource graphics_id);
132 bool full_frame() const { return full_frame_; } 134 bool full_frame() const { return full_frame_; }
133 bool SetCursor(PP_CursorType_Dev type); 135 bool SetCursor(PP_CursorType_Dev type);
134 PP_Var ExecuteScript(PP_Var script, PP_Var* exception); 136 PP_Var ExecuteScript(PP_Var script, PP_Var* exception);
137 void PostMessage(PP_Var message);
135 138
136 // PPP_Instance pass-through. 139 // PPP_Instance pass-through.
137 void Delete(); 140 void Delete();
138 bool Initialize(WebKit::WebPluginContainer* container, 141 bool Initialize(WebKit::WebPluginContainer* container,
139 const std::vector<std::string>& arg_names, 142 const std::vector<std::string>& arg_names,
140 const std::vector<std::string>& arg_values, 143 const std::vector<std::string>& arg_values,
141 bool full_frame); 144 bool full_frame);
142 bool HandleDocumentLoad(PPB_URLLoader_Impl* loader); 145 bool HandleDocumentLoad(PPB_URLLoader_Impl* loader);
143 bool HandleInputEvent(const WebKit::WebInputEvent& event, 146 bool HandleInputEvent(const WebKit::WebInputEvent& event,
144 WebKit::WebCursorInfo* cursor_info); 147 WebKit::WebCursorInfo* cursor_info);
148 void HandleMessage(PP_Var message);
145 PP_Var GetInstanceObject(); 149 PP_Var GetInstanceObject();
146 void ViewChanged(const gfx::Rect& position, const gfx::Rect& clip); 150 void ViewChanged(const gfx::Rect& position, const gfx::Rect& clip);
147 151
148 // Notifications about focus changes, see has_webkit_focus_ below. 152 // Notifications about focus changes, see has_webkit_focus_ below.
149 void SetWebKitFocus(bool has_focus); 153 void SetWebKitFocus(bool has_focus);
150 void SetContentAreaFocus(bool has_focus); 154 void SetContentAreaFocus(bool has_focus);
151 155
152 // Notifications that the view has rendered the page and that it has been 156 // Notifications that the view has rendered the page and that it has been
153 // flushed to the screen. These messages are used to send Flush callbacks to 157 // flushed to the screen. These messages are used to send Flush callbacks to
154 // the plugin for DeviceContext2D. 158 // the plugin for DeviceContext2D.
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 bool always_on_top_; 355 bool always_on_top_;
352 356
353 // Plugin container for fullscreen mode. NULL if not in fullscreen mode. Note: 357 // Plugin container for fullscreen mode. NULL if not in fullscreen mode. Note:
354 // there is a transition state where fullscreen_container_ is non-NULL but 358 // there is a transition state where fullscreen_container_ is non-NULL but
355 // fullscreen_ is false (see above). 359 // fullscreen_ is false (see above).
356 FullscreenContainer* fullscreen_container_; 360 FullscreenContainer* fullscreen_container_;
357 361
358 // True if we are in fullscreen mode. Note: it is false during the transition. 362 // True if we are in fullscreen mode. Note: it is false during the transition.
359 bool fullscreen_; 363 bool fullscreen_;
360 364
365 // The MessageChannel used to implement bidirectional postMessage for the
366 // instance.
367 scoped_ptr<MessageChannel> message_channel_;
368
361 typedef std::set<PluginObject*> PluginObjectSet; 369 typedef std::set<PluginObject*> PluginObjectSet;
362 PluginObjectSet live_plugin_objects_; 370 PluginObjectSet live_plugin_objects_;
363 371
364 // Tracks all live ObjectVars used by this module so we can map NPObjects to 372 // Tracks all live ObjectVars used by this module so we can map NPObjects to
365 // the corresponding object. These are non-owning references. 373 // the corresponding object. These are non-owning references.
366 typedef std::map<NPObject*, ObjectVar*> NPObjectToObjectVarMap; 374 typedef std::map<NPObject*, ObjectVar*> NPObjectToObjectVarMap;
367 NPObjectToObjectVarMap np_object_to_object_var_; 375 NPObjectToObjectVarMap np_object_to_object_var_;
368 376
369 DISALLOW_COPY_AND_ASSIGN(PluginInstance); 377 DISALLOW_COPY_AND_ASSIGN(PluginInstance);
370 }; 378 };
371 379
372 } // namespace ppapi 380 } // namespace ppapi
373 } // namespace webkit 381 } // namespace webkit
374 382
375 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ 383 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698