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 1d343b19e9812fd3b320e0b43382c3ecc188ef62..32fa8dfed02fa4ba90a05967c8bd6b8be15c2176 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(); |
| + |
|
Charlie Reis
2013/02/13 01:44:47
nit: Remove extra line.
lazyboy
2013/02/13 04:07:48
Done.
|
| // Overridden in tests. |
| virtual void SetDamageBuffer( |
| const BrowserPluginHostMsg_ResizeGuest_Params& params); |
| @@ -178,6 +184,11 @@ class CONTENT_EXPORT BrowserPluginGuest : public NotificationObserver, |
| uint32 sync_point); |
| private: |
| + typedef std::pair<content::MediaStreamRequest, content::MediaResponseCallback> |
| + MediaStreamRequestAndCallbackPair; |
| + typedef std::map<int, MediaStreamRequestAndCallbackPair> |
| + MediaStreamRequestsMap; |
| + |
| friend class TestBrowserPluginGuest; |
| BrowserPluginGuest(int instance_id, |
| @@ -202,6 +213,12 @@ class CONTENT_EXPORT BrowserPluginGuest : public NotificationObserver, |
| // Message handlers for messsages from embedder. |
| + // Allows or denies a permission request access, after the embedder has had a |
| + // chance to decide. |
| + void OnAllowPermission(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 |
| @@ -317,6 +334,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_; |
| + // 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); |
| }; |