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

Side by Side Diff: chrome/browser/media/public_session_media_access_handler.h

Issue 2552203007: Public Sessions - prompt the user for pageCapture requests (Closed)
Patch Set: Devlin's comments, added other files Created 3 years, 11 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 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 CHROME_BROWSER_MEDIA_PUBLIC_SESSION_MEDIA_ACCESS_HANDLER_H_ 5 #ifndef CHROME_BROWSER_MEDIA_PUBLIC_SESSION_MEDIA_ACCESS_HANDLER_H_
6 #define CHROME_BROWSER_MEDIA_PUBLIC_SESSION_MEDIA_ACCESS_HANDLER_H_ 6 #define CHROME_BROWSER_MEDIA_PUBLIC_SESSION_MEDIA_ACCESS_HANDLER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "chrome/browser/extensions/extension_install_prompt.h" 9 #include "chrome/browser/extensions/extension_install_prompt.h"
10 #include "chrome/browser/media/extension_media_access_handler.h" 10 #include "chrome/browser/media/extension_media_access_handler.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 const extensions::Extension* extension) override; 43 const extensions::Extension* extension) override;
44 44
45 private: 45 private:
46 // Helper function used to chain the HandleRequest call into the original 46 // Helper function used to chain the HandleRequest call into the original
47 // inside of ExtensionMediaAccessHandler. 47 // inside of ExtensionMediaAccessHandler.
48 void ChainHandleRequest(content::WebContents* web_contents, 48 void ChainHandleRequest(content::WebContents* web_contents,
49 const content::MediaStreamRequest& request, 49 const content::MediaStreamRequest& request,
50 const content::MediaResponseCallback& callback, 50 const content::MediaResponseCallback& callback,
51 const extensions::Extension* extension); 51 const extensions::Extension* extension);
52 52
53 // Function used to resolve user decision regarding allowing audio/video.
54 void ResolvePermissionPrompt(content::WebContents* web_contents,
55 const content::MediaStreamRequest& request,
56 const content::MediaResponseCallback& callback,
57 const extensions::Extension* extension,
58 ExtensionInstallPrompt::Result prompt_result);
59
60 // Class used to cache user choice regarding allowing audio/video capture.
61 class UserChoice {
62 public:
63 // Helper function for checking if audio/video is allowed by user choice.
64 bool IsAllowed(content::MediaStreamType type) const;
65 // Helper function which returns true if audio/video wasn't prompted yet.
66 bool NeedsPrompting(content::MediaStreamType type) const;
67 void Set(content::MediaStreamType type, bool allowed);
68 void SetPrompted(content::MediaStreamType type);
69
70 private:
71 bool audio_prompted_ = false;
72 bool audio_allowed_ = false;
73 bool video_prompted_ = false;
74 bool video_allowed_ = false;
75 };
76
77 std::map<extensions::ExtensionId, UserChoice> user_choice_cache_;
78 std::map<extensions::ExtensionId, std::unique_ptr<ExtensionInstallPrompt>>
79 extension_install_prompt_map_;
80 ExtensionMediaAccessHandler extension_media_access_handler_; 53 ExtensionMediaAccessHandler extension_media_access_handler_;
81 54
82 DISALLOW_COPY_AND_ASSIGN(PublicSessionMediaAccessHandler); 55 DISALLOW_COPY_AND_ASSIGN(PublicSessionMediaAccessHandler);
83 }; 56 };
84 57
85 #endif // CHROME_BROWSER_MEDIA_PUBLIC_SESSION_MEDIA_ACCESS_HANDLER_H_ 58 #endif // CHROME_BROWSER_MEDIA_PUBLIC_SESSION_MEDIA_ACCESS_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698