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

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

Issue 11093080: <webview>: First stab at implementing media permission request for guests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Implement first allow/deny wins, still requires preventDefault impl + now tests pass. Created 7 years, 10 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) 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 // A request to enable hardware compositing. 114 // A request to enable hardware compositing.
115 void EnableCompositing(bool enable); 115 void EnableCompositing(bool enable);
116 116
117 // Returns true if |point| lies within the bounds of the plugin rectangle. 117 // Returns true if |point| lies within the bounds of the plugin rectangle.
118 // Not OK to use this function for making security-sensitive decision since it 118 // Not OK to use this function for making security-sensitive decision since it
119 // can return false positives when the plugin has rotation transformation 119 // can return false positives when the plugin has rotation transformation
120 // applied. 120 // applied.
121 bool InBounds(const gfx::Point& point) const; 121 bool InBounds(const gfx::Point& point) const;
122 122
123 gfx::Point ToLocalCoordinates(const gfx::Point& point) const; 123 gfx::Point ToLocalCoordinates(const gfx::Point& point) const;
124 // Called by browser plugin binding.
125 void OnListenerCallMediaAccess(int request_id, bool allow);
126
124 127
125 // WebKit::WebPlugin implementation. 128 // WebKit::WebPlugin implementation.
126 virtual WebKit::WebPluginContainer* container() const OVERRIDE; 129 virtual WebKit::WebPluginContainer* container() const OVERRIDE;
127 virtual bool initialize(WebKit::WebPluginContainer* container) OVERRIDE; 130 virtual bool initialize(WebKit::WebPluginContainer* container) OVERRIDE;
128 virtual void destroy() OVERRIDE; 131 virtual void destroy() OVERRIDE;
129 virtual NPObject* scriptableObject() OVERRIDE; 132 virtual NPObject* scriptableObject() OVERRIDE;
130 virtual bool supportsKeyboardFocus() const OVERRIDE; 133 virtual bool supportsKeyboardFocus() const OVERRIDE;
131 virtual bool canProcessDrag() const OVERRIDE; 134 virtual bool canProcessDrag() const OVERRIDE;
132 virtual void paint( 135 virtual void paint(
133 WebKit::WebCanvas* canvas, 136 WebKit::WebCanvas* canvas,
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 void GetDamageBufferWithSizeParams( 234 void GetDamageBufferWithSizeParams(
232 BrowserPluginHostMsg_AutoSize_Params* auto_size_params, 235 BrowserPluginHostMsg_AutoSize_Params* auto_size_params,
233 BrowserPluginHostMsg_ResizeGuest_Params* resize_guest_params); 236 BrowserPluginHostMsg_ResizeGuest_Params* resize_guest_params);
234 237
235 // Informs the guest of an updated autosize state. 238 // Informs the guest of an updated autosize state.
236 void UpdateGuestAutoSizeState(bool current_auto_size); 239 void UpdateGuestAutoSizeState(bool current_auto_size);
237 240
238 // Informs the BrowserPlugin that guest has changed its size in autosize mode. 241 // Informs the BrowserPlugin that guest has changed its size in autosize mode.
239 void SizeChangedDueToAutoSize(const gfx::Size& old_view_size); 242 void SizeChangedDueToAutoSize(const gfx::Size& old_view_size);
240 243
244 bool HasEventListeners(const std::string& event_name);
245
241 // Indicates whether a damage buffer was used by the guest process for the 246 // Indicates whether a damage buffer was used by the guest process for the
242 // provided |params|. 247 // provided |params|.
243 static bool UsesDamageBuffer( 248 static bool UsesDamageBuffer(
244 const BrowserPluginMsg_UpdateRect_Params& params); 249 const BrowserPluginMsg_UpdateRect_Params& params);
245 250
246 // Indicates whether the |pending_damage_buffer_| was used to copy over pixels 251 // Indicates whether the |pending_damage_buffer_| was used to copy over pixels
247 // given the provided |params|. 252 // given the provided |params|.
248 bool UsesPendingDamageBuffer( 253 bool UsesPendingDamageBuffer(
249 const BrowserPluginMsg_UpdateRect_Params& params); 254 const BrowserPluginMsg_UpdateRect_Params& params);
250 255
(...skipping 24 matching lines...) Expand all
275 const GURL& old_url, 280 const GURL& old_url,
276 const GURL& new_url, 281 const GURL& new_url,
277 bool is_top_level); 282 bool is_top_level);
278 void OnLoadStart(int instance_id, const GURL& url, bool is_top_level); 283 void OnLoadStart(int instance_id, const GURL& url, bool is_top_level);
279 void OnLoadStop(int instance_id); 284 void OnLoadStop(int instance_id);
280 void OnSetCursor(int instance_id, const WebCursor& cursor); 285 void OnSetCursor(int instance_id, const WebCursor& cursor);
281 void OnShouldAcceptTouchEvents(int instance_id, bool accept); 286 void OnShouldAcceptTouchEvents(int instance_id, bool accept);
282 void OnUpdatedName(int instance_id, const std::string& name); 287 void OnUpdatedName(int instance_id, const std::string& name);
283 void OnUpdateRect(int instance_id, 288 void OnUpdateRect(int instance_id,
284 const BrowserPluginMsg_UpdateRect_Params& params); 289 const BrowserPluginMsg_UpdateRect_Params& params);
290 // Requests media access permission from the embedder.
291 void OnRequestMediaAccess(int instance_id,
292 int request_id,
293 const GURL& security_origin);
294 // Informs the BrowserPlugin that the guest's request for media access has
295 // been allowed or denied by the embedder.
296 void RespondMediaAccess(int request_id, bool allow);
297
285 298
286 int instance_id_; 299 int instance_id_;
287 base::WeakPtr<RenderViewImpl> render_view_; 300 base::WeakPtr<RenderViewImpl> render_view_;
288 // We cache the |render_view_|'s routing ID because we need it on destruction. 301 // We cache the |render_view_|'s routing ID because we need it on destruction.
289 // If the |render_view_| is destroyed before the BrowserPlugin is destroyed 302 // If the |render_view_| is destroyed before the BrowserPlugin is destroyed
290 // then we will attempt to access a NULL pointer. 303 // then we will attempt to access a NULL pointer.
291 int render_view_routing_id_; 304 int render_view_routing_id_;
292 WebKit::WebPluginContainer* container_; 305 WebKit::WebPluginContainer* container_;
293 scoped_ptr<BrowserPluginBindings> bindings_; 306 scoped_ptr<BrowserPluginBindings> bindings_;
294 scoped_ptr<BrowserPluginBackingStore> backing_store_; 307 scoped_ptr<BrowserPluginBackingStore> backing_store_;
(...skipping 18 matching lines...) Expand all
313 bool plugin_focused_; 326 bool plugin_focused_;
314 // Tracks the visibility of the browser plugin regardless of the whole 327 // Tracks the visibility of the browser plugin regardless of the whole
315 // embedder RenderView's visibility. 328 // embedder RenderView's visibility.
316 bool visible_; 329 bool visible_;
317 330
318 WebCursor cursor_; 331 WebCursor cursor_;
319 332
320 gfx::Size last_view_size_; 333 gfx::Size last_view_size_;
321 bool size_changed_in_flight_; 334 bool size_changed_in_flight_;
322 bool allocate_instance_id_sent_; 335 bool allocate_instance_id_sent_;
336 typedef std::set<int> MediaAccessPendingRequestIds;
337 MediaAccessPendingRequestIds media_access_pending_request_ids_;
323 338
324 // BrowserPlugin outlives RenderViewImpl in Chrome Apps and so we need to 339 // BrowserPlugin outlives RenderViewImpl in Chrome Apps and so we need to
325 // store the BrowserPlugin's BrowserPluginManager in a member variable to 340 // store the BrowserPlugin's BrowserPluginManager in a member variable to
326 // avoid accessing the RenderViewImpl. 341 // avoid accessing the RenderViewImpl.
327 scoped_refptr<BrowserPluginManager> browser_plugin_manager_; 342 scoped_refptr<BrowserPluginManager> browser_plugin_manager_;
328 343
329 // Important: Do not add more history state here. 344 // Important: Do not add more history state here.
330 // We strongly discourage storing additional history state (such as page IDs) 345 // We strongly discourage storing additional history state (such as page IDs)
331 // in the embedder process, at the risk of having incorrect information that 346 // in the embedder process, at the risk of having incorrect information that
332 // can lead to broken back/forward logic in apps. 347 // can lead to broken back/forward logic in apps.
333 // It's also important that this state does not get modified by any logic in 348 // It's also important that this state does not get modified by any logic in
334 // the embedder process. It should only be updated in response to navigation 349 // the embedder process. It should only be updated in response to navigation
335 // events in the guest. No assumptions should be made about how the index 350 // events in the guest. No assumptions should be made about how the index
336 // will change after a navigation (e.g., for back, forward, or go), because 351 // will change after a navigation (e.g., for back, forward, or go), because
337 // the changes are not always obvious. For example, there is a maximum 352 // the changes are not always obvious. For example, there is a maximum
338 // number of entries and earlier ones will automatically be pruned. 353 // number of entries and earlier ones will automatically be pruned.
339 int current_nav_entry_index_; 354 int current_nav_entry_index_;
340 int nav_entry_count_; 355 int nav_entry_count_;
341 356
342 // Used for HW compositing. 357 // Used for HW compositing.
343 bool compositing_enabled_; 358 bool compositing_enabled_;
344 scoped_refptr<BrowserPluginCompositingHelper> compositing_helper_; 359 scoped_refptr<BrowserPluginCompositingHelper> compositing_helper_;
345 360
346 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); 361 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin);
347 }; 362 };
348 363
349 } // namespace content 364 } // namespace content
350 365
351 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ 366 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698