| OLD | NEW |
| (Empty) |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_MEDIA_PUBLIC_SESSION_TAB_CAPTURE_ACCESS_HANDLER_H_ | |
| 6 #define CHROME_BROWSER_MEDIA_PUBLIC_SESSION_TAB_CAPTURE_ACCESS_HANDLER_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "chrome/browser/extensions/extension_install_prompt.h" | |
| 10 #include "chrome/browser/media/capture_access_handler_base.h" | |
| 11 #include "chrome/browser/media/webrtc/tab_capture_access_handler.h" | |
| 12 #include "content/public/common/media_stream_request.h" | |
| 13 #include "extensions/common/extension_id.h" | |
| 14 #include "extensions/common/permissions/api_permission_set.h" | |
| 15 | |
| 16 // MediaAccessHandler for TabCapture API in Public Sessions. This class is | |
| 17 // implemented as a wrapper around TabCaptureAccessHandler. It allows for finer | |
| 18 // access control to the TabCapture manifest permission feature inside of Public | |
| 19 // Sessions. | |
| 20 // | |
| 21 // In Public Sessions, extensions (and apps) are force-installed by admin policy | |
| 22 // so the user does not get a chance to review the permissions for these | |
| 23 // extensions. This is not acceptable from a security/privacy standpoint, so | |
| 24 // when an extension uses the TabCapture API for the first time, we show the | |
| 25 // user a dialog where they can choose whether to allow the extension access to | |
| 26 // the API. | |
| 27 class PublicSessionTabCaptureAccessHandler : public CaptureAccessHandlerBase { | |
| 28 public: | |
| 29 PublicSessionTabCaptureAccessHandler(); | |
| 30 ~PublicSessionTabCaptureAccessHandler() override; | |
| 31 | |
| 32 // MediaAccessHandler implementation. | |
| 33 bool SupportsStreamType(const content::MediaStreamType type, | |
| 34 const extensions::Extension* extension) override; | |
| 35 bool CheckMediaAccessPermission( | |
| 36 content::WebContents* web_contents, | |
| 37 const GURL& security_origin, | |
| 38 content::MediaStreamType type, | |
| 39 const extensions::Extension* extension) override; | |
| 40 void HandleRequest(content::WebContents* web_contents, | |
| 41 const content::MediaStreamRequest& request, | |
| 42 const content::MediaResponseCallback& callback, | |
| 43 const extensions::Extension* extension) override; | |
| 44 | |
| 45 private: | |
| 46 // Helper function used to chain the HandleRequest call into the original | |
| 47 // inside of TabCaptureAccessHandler. | |
| 48 void ChainHandleRequest( | |
| 49 content::WebContents* web_contents, | |
| 50 const content::MediaStreamRequest& request, | |
| 51 const content::MediaResponseCallback& callback, | |
| 52 const extensions::Extension* extension, | |
| 53 const extensions::PermissionIDSet& allowed_permissions); | |
| 54 | |
| 55 TabCaptureAccessHandler tab_capture_access_handler_; | |
| 56 | |
| 57 DISALLOW_COPY_AND_ASSIGN(PublicSessionTabCaptureAccessHandler); | |
| 58 }; | |
| 59 | |
| 60 #endif // CHROME_BROWSER_MEDIA_PUBLIC_SESSION_TAB_CAPTURE_ACCESS_HANDLER_H_ | |
| OLD | NEW |