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

Unified Diff: chrome/browser/media/public_session_tab_capture_access_handler.h

Issue 2552203007: Public Sessions - prompt the user for pageCapture requests (Closed)
Patch Set: Nitfix Created 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/media/public_session_tab_capture_access_handler.h
diff --git a/chrome/browser/media/webrtc/public_session_tab_capture_access_handler.h b/chrome/browser/media/public_session_tab_capture_access_handler.h
similarity index 56%
rename from chrome/browser/media/webrtc/public_session_tab_capture_access_handler.h
rename to chrome/browser/media/public_session_tab_capture_access_handler.h
index a22dfad25665da6a2920c3a940df10d09679d10f..08446fcce02b17a70e5fab6bb9bb3ba6641d26d5 100644
--- a/chrome/browser/media/webrtc/public_session_tab_capture_access_handler.h
+++ b/chrome/browser/media/public_session_tab_capture_access_handler.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_MEDIA_WEBRTC_PUBLIC_SESSION_TAB_CAPTURE_ACCESS_HANDLER_H_
-#define CHROME_BROWSER_MEDIA_WEBRTC_PUBLIC_SESSION_TAB_CAPTURE_ACCESS_HANDLER_H_
+#ifndef CHROME_BROWSER_MEDIA_PUBLIC_SESSION_TAB_CAPTURE_ACCESS_HANDLER_H_
+#define CHROME_BROWSER_MEDIA_PUBLIC_SESSION_TAB_CAPTURE_ACCESS_HANDLER_H_
#include "base/macros.h"
#include "chrome/browser/extensions/extension_install_prompt.h"
@@ -11,6 +11,7 @@
#include "chrome/browser/media/webrtc/tab_capture_access_handler.h"
#include "content/public/common/media_stream_request.h"
#include "extensions/common/extension_id.h"
+#include "extensions/common/permissions/api_permission_set.h"
// MediaAccessHandler for TabCapture API in Public Sessions. This class is
// implemented as a wrapper around TabCaptureAccessHandler. It allows for finer
@@ -23,9 +24,6 @@
// when an extension uses the TabCapture API for the first time, we show the
// user a dialog where they can choose whether to allow the extension access to
// the API.
-//
-// TODO(isandrk): Refactor common code out of this class and
-// PublicSessionMediaAccessHandler (crbug.com/672620).
class PublicSessionTabCaptureAccessHandler : public CaptureAccessHandlerBase {
public:
PublicSessionTabCaptureAccessHandler();
@@ -47,39 +45,16 @@ class PublicSessionTabCaptureAccessHandler : public CaptureAccessHandlerBase {
private:
// Helper function used to chain the HandleRequest call into the original
// inside of TabCaptureAccessHandler.
- void ChainHandleRequest(content::WebContents* web_contents,
- const content::MediaStreamRequest& request,
- const content::MediaResponseCallback& callback,
- const extensions::Extension* extension);
-
- // Function used to resolve user decision regarding allowing tab capture.
- void ResolvePermissionPrompt(content::WebContents* web_contents,
- const content::MediaStreamRequest& request,
- const content::MediaResponseCallback& callback,
- const extensions::Extension* extension,
- ExtensionInstallPrompt::Result prompt_result);
-
- // Class used to cache user choice regarding allowing tab capture.
- class UserChoice {
- public:
- // Helper function for checking if tab capture is allowed by user choice.
- bool IsAllowed() const;
- // Helper function which returns true if user choice wasn't prompted yet.
- bool NeedsPrompting() const;
- void Set(bool allowed);
- void SetPrompted();
-
- private:
- bool tab_capture_prompted_ = false;
- bool tab_capture_allowed_ = false;
- };
+ void ChainHandleRequest(
+ content::WebContents* web_contents,
+ const content::MediaStreamRequest& request,
+ const content::MediaResponseCallback& callback,
+ const extensions::Extension* extension,
+ const extensions::PermissionIDSet& allowed_permissions);
- std::map<extensions::ExtensionId, UserChoice> user_choice_cache_;
- std::map<extensions::ExtensionId, std::unique_ptr<ExtensionInstallPrompt>>
- extension_install_prompt_map_;
TabCaptureAccessHandler tab_capture_access_handler_;
DISALLOW_COPY_AND_ASSIGN(PublicSessionTabCaptureAccessHandler);
};
-#endif // CHROME_BROWSER_MEDIA_WEBRTC_PUBLIC_SESSION_TAB_CAPTURE_ACCESS_HANDLER_H_
+#endif // CHROME_BROWSER_MEDIA_PUBLIC_SESSION_TAB_CAPTURE_ACCESS_HANDLER_H_

Powered by Google App Engine
This is Rietveld 408576698