Chromium Code Reviews| Index: content/browser/browser_plugin/browser_plugin_guest.h |
| diff --git a/content/browser/browser_plugin/browser_plugin_guest.h b/content/browser/browser_plugin/browser_plugin_guest.h |
| index f0b3039019282c15f0822198145f4d4ffb08597c..0ab7225f10e6866c3342a76bec7c0be8719301e4 100644 |
| --- a/content/browser/browser_plugin/browser_plugin_guest.h |
| +++ b/content/browser/browser_plugin/browser_plugin_guest.h |
| @@ -58,6 +58,7 @@ namespace content { |
| class BrowserPluginHostFactory; |
| class BrowserPluginEmbedder; |
| class RenderProcessHost; |
| +struct MediaStreamRequest; |
| // A browser plugin guest provides functionality for WebContents to operate in |
| // the guest role and implements guest specific overrides for ViewHostMsg_* |
| @@ -147,6 +148,10 @@ class CONTENT_EXPORT BrowserPluginGuest : public NotificationObserver, |
| virtual void RunFileChooser(WebContents* web_contents, |
| const FileChooserParams& params) OVERRIDE; |
| virtual bool ShouldFocusPageAfterCrash() OVERRIDE; |
| + virtual void RequestMediaAccessPermission( |
| + WebContents* web_contents, |
| + const content::MediaStreamRequest& request, |
| + const content::MediaResponseCallback& callback) OVERRIDE; |
| // Exposes the protected web_contents() from WebContentsObserver. |
| WebContents* GetWebContents(); |
| @@ -154,6 +159,7 @@ class CONTENT_EXPORT BrowserPluginGuest : public NotificationObserver, |
| // Kill the guest process. |
| void Terminate(); |
| + |
| // Overridden in tests. |
| virtual void SetDamageBuffer( |
| const BrowserPluginHostMsg_ResizeGuest_Params& params); |
| @@ -171,6 +177,11 @@ class CONTENT_EXPORT BrowserPluginGuest : public NotificationObserver, |
| int instance_id() const { return instance_id_; } |
| private: |
| + typedef std::pair<content::MediaStreamRequest, content::MediaResponseCallback> |
| + MediaStreamRequestAndCallbackPair; |
| + typedef std::map<int, MediaStreamRequestAndCallbackPair> |
| + MediaStreamRequestsMap; |
| + |
| friend class TestBrowserPluginGuest; |
| BrowserPluginGuest(int instance_id, |
| @@ -195,6 +206,12 @@ class CONTENT_EXPORT BrowserPluginGuest : public NotificationObserver, |
| // Message handlers for messsages from embedder. |
| + // Allows or denies a media access request, after the embedder has had a |
| + // chance to decide. |
| + void OnAllowPermissionAccess(int instance_id, |
| + const std::string& permission_type, |
| + int request_id, |
| + bool should_allow); |
| // Handles drag events from the embedder. |
| // When dragging, the drag events go to the embedder first, and if the drag |
| // happens on the browser plugin, then the plugin sends a corresponding |
| @@ -303,6 +320,15 @@ class CONTENT_EXPORT BrowserPluginGuest : public NotificationObserver, |
| gfx::Size max_auto_size_; |
| gfx::Size min_auto_size_; |
| + // A counter to generate unique request id for a media access request. |
| + // We only need the ids to be unique for a given BrowserPluginGuest. |
| + int current_media_access_request_id_; |
|
Charlie Reis
2013/02/11 22:20:56
Are we going to need a counter and map for each ty
lazyboy
2013/02/12 05:03:45
The counter can be one, but different types of per
|
| + // A map to store WebContents's media request object and callback. |
| + // We need to store these because we need a roundtrip to the embedder to know |
| + // if we allow or disallow the request. The key of the map is unique only for |
| + // a given BrowserPluginGuest. |
| + MediaStreamRequestsMap media_requests_map_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); |
| }; |