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

Side by Side Diff: content/renderer/browser_plugin/browser_plugin.h

Issue 11368071: browser-plugin: Remove event handling code, and use CustomEvents in webkit instead. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tot-merge Created 8 years, 1 month 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ 5 #ifndef CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_
6 #define CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ 6 #define CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_
7 7
8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPlugin.h" 8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPlugin.h"
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 bool ShouldGuestBeFocused() const; 107 bool ShouldGuestBeFocused() const;
108 108
109 // Inform the BrowserPlugin that the guest's contentWindow is ready, 109 // Inform the BrowserPlugin that the guest's contentWindow is ready,
110 // and provide it with a routing ID to grab it. 110 // and provide it with a routing ID to grab it.
111 void GuestContentWindowReady(int content_window_routing_id); 111 void GuestContentWindowReady(int content_window_routing_id);
112 112
113 // Informs the BrowserPlugin that the guest has started/stopped accepting 113 // Informs the BrowserPlugin that the guest has started/stopped accepting
114 // touch events. 114 // touch events.
115 void SetAcceptTouchEvents(bool accept); 115 void SetAcceptTouchEvents(bool accept);
116 116
117 // Indicates whether there are any Javascript listeners attached to a
118 // provided event_name.
119 bool HasListeners(const std::string& event_name);
120 // Add a custom event listener to this BrowserPlugin instance.
121 bool AddEventListener(const std::string& event_name,
122 v8::Local<v8::Function> function);
123 // Remove a custom event listener from this BrowserPlugin instance.
124 bool RemoveEventListener(const std::string& event_name,
125 v8::Local<v8::Function> function);
126 // Tells the BrowserPlugin to tell the guest to navigate to the previous 117 // Tells the BrowserPlugin to tell the guest to navigate to the previous
127 // navigation entry in the navigation history. 118 // navigation entry in the navigation history.
128 void Back(); 119 void Back();
129 // Tells the BrowserPlugin to tell the guest to navigate to the next 120 // Tells the BrowserPlugin to tell the guest to navigate to the next
130 // navigation entry in the navigation history. 121 // navigation entry in the navigation history.
131 void Forward(); 122 void Forward();
132 // Tells the BrowserPlugin to tell the guest to navigate to a position 123 // Tells the BrowserPlugin to tell the guest to navigate to a position
133 // relative to the current index in its navigation history. 124 // relative to the current index in its navigation history.
134 void Go(int relativeIndex); 125 void Go(int relativeIndex);
135 // Tells the BrowserPlugin to terminate the guest process. 126 // Tells the BrowserPlugin to terminate the guest process.
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 // Initializes the valid events. 209 // Initializes the valid events.
219 void InitializeEvents(); 210 void InitializeEvents();
220 211
221 // Cleanup event listener state to free v8 resources when a BrowserPlugin 212 // Cleanup event listener state to free v8 resources when a BrowserPlugin
222 // is destroyed. 213 // is destroyed.
223 void RemoveEventListeners(); 214 void RemoveEventListeners();
224 215
225 // Returns whether |event_name| is a valid event. 216 // Returns whether |event_name| is a valid event.
226 bool IsValidEvent(const std::string& event_name); 217 bool IsValidEvent(const std::string& event_name);
227 218
228 // Triggers the event-listeners for |event_name|. 219 // Triggers the event-listeners for |event_name|. Note that the function
220 // frees all the values in |props|.
229 void TriggerEvent(const std::string& event_name, 221 void TriggerEvent(const std::string& event_name,
230 v8::Local<v8::Object>* event); 222 std::map<std::string, base::Value*>* props);
231 223
232 // Creates and maps transport dib. Overridden in tests. 224 // Creates and maps transport dib. Overridden in tests.
233 virtual TransportDIB* CreateTransportDIB(const size_t size); 225 virtual TransportDIB* CreateTransportDIB(const size_t size);
234 // Frees up the damage buffer. Overridden in tests. 226 // Frees up the damage buffer. Overridden in tests.
235 virtual void FreeDamageBuffer(); 227 virtual void FreeDamageBuffer();
236 228
237 // Populates BrowserPluginHostMsg_AutoSize_Params object with autosize state. 229 // Populates BrowserPluginHostMsg_AutoSize_Params object with autosize state.
238 void PopulateAutoSizeParameters( 230 void PopulateAutoSizeParameters(
239 BrowserPluginHostMsg_AutoSize_Params* params) const; 231 BrowserPluginHostMsg_AutoSize_Params* params) const;
240 // Informs the guest of an updated autosize state. 232 // Informs the guest of an updated autosize state.
(...skipping 25 matching lines...) Expand all
266 int min_width_; 258 int min_width_;
267 int process_id_; 259 int process_id_;
268 std::string storage_partition_id_; 260 std::string storage_partition_id_;
269 bool persist_storage_; 261 bool persist_storage_;
270 int content_window_routing_id_; 262 int content_window_routing_id_;
271 bool plugin_focused_; 263 bool plugin_focused_;
272 bool embedder_focused_; 264 bool embedder_focused_;
273 // Tracks the visibility of the browser plugin regardless of the whole 265 // Tracks the visibility of the browser plugin regardless of the whole
274 // embedder RenderView's visibility. 266 // embedder RenderView's visibility.
275 bool visible_; 267 bool visible_;
276 typedef std::vector<v8::Local<v8::Function> > EventListenersLocal;
277 typedef std::vector<v8::Persistent<v8::Function> > EventListeners;
278 typedef std::map<std::string, EventListeners> EventListenerMap;
279 EventListenerMap event_listener_map_;
280 // Important: Do not add more history state here. 268 // Important: Do not add more history state here.
281 // We strongly discourage storing additional history state (such as page IDs) 269 // We strongly discourage storing additional history state (such as page IDs)
282 // in the embedder process, at the risk of having incorrect information that 270 // in the embedder process, at the risk of having incorrect information that
283 // can lead to broken back/forward logic in apps. 271 // can lead to broken back/forward logic in apps.
284 // It's also important that this state does not get modified by any logic in 272 // It's also important that this state does not get modified by any logic in
285 // the embedder process. It should only be updated in response to navigation 273 // the embedder process. It should only be updated in response to navigation
286 // events in the guest. No assumptions should be made about how the index 274 // events in the guest. No assumptions should be made about how the index
287 // will change after a navigation (e.g., for back, forward, or go), because 275 // will change after a navigation (e.g., for back, forward, or go), because
288 // the changes are not always obvious. For example, there is a maximum 276 // the changes are not always obvious. For example, there is a maximum
289 // number of entries and earlier ones will automatically be pruned. 277 // number of entries and earlier ones will automatically be pruned.
290 int current_nav_entry_index_; 278 int current_nav_entry_index_;
291 int nav_entry_count_; 279 int nav_entry_count_;
292 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); 280 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin);
293 }; 281 };
294 282
295 } // namespace content 283 } // namespace content
296 284
297 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ 285 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698