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

Unified Diff: chrome/browser/media/media_stream_devices_controller.cc

Issue 2254763002: Enable the optional permission prompt persistence toggle on grouped infobars (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@permission-infobardelegate-clean
Patch Set: Add metric logging Created 4 years, 4 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/media_stream_devices_controller.cc
diff --git a/chrome/browser/media/media_stream_devices_controller.cc b/chrome/browser/media/media_stream_devices_controller.cc
index 6b8aa8c3540669a6b9cbc0c2cf65523b7a38cfce..bab0d9578ef09ac4e41790063290ccd3c87ea435 100644
--- a/chrome/browser/media/media_stream_devices_controller.cc
+++ b/chrome/browser/media/media_stream_devices_controller.cc
@@ -32,7 +32,6 @@
#include "components/prefs/scoped_user_pref_update.h"
#include "components/url_formatter/elide_url.h"
#include "content/public/browser/browser_thread.h"
-#include "content/public/browser/permission_type.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_widget_host_view.h"
@@ -257,6 +256,29 @@ base::string16 MediaStreamDevicesController::GetMessageText() const {
GetOrigin(), url_formatter::SchemeDisplay::OMIT_CRYPTOGRAPHIC));
}
+content::PermissionType
+MediaStreamDevicesController::GetPermissionTypeForContentSettingsType(
raymes 2016/08/18 06:10:00 We might as well use GetPermissionType from permis
dominickn 2016/08/18 06:38:20 Done.
raymes 2016/08/22 04:37:19 I think we should just remove this and use Permiss
dominickn 2016/08/23 20:13:16 GetPermissionType's signature is a little awkward;
+ ContentSettingsType content_type) const {
+ if (content_type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC) {
+ return content::PermissionType::AUDIO_CAPTURE;
+ } else {
+ DCHECK_EQ(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, content_type);
+ return content::PermissionType::VIDEO_CAPTURE;
+ }
+}
+
+void MediaStreamDevicesController::PermissionGranted(bool persist) {
+ base::AutoReset<bool> persist_permissions(
+ &persist_permission_changes_, persist);
+ PermissionGranted();
+}
+
+void MediaStreamDevicesController::PermissionDenied(bool persist) {
+ base::AutoReset<bool> persist_permissions(
+ &persist_permission_changes_, persist);
+ PermissionDenied();
+}
+
void MediaStreamDevicesController::ForcePermissionDeniedTemporarily() {
base::AutoReset<bool> persist_permissions(
&persist_permission_changes_, false);
@@ -579,14 +601,8 @@ ContentSetting MediaStreamDevicesController::GetContentSetting(
return CONTENT_SETTING_BLOCK;
}
- content::PermissionType permission_type;
- if (content_type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC) {
- permission_type = content::PermissionType::AUDIO_CAPTURE;
- } else {
- DCHECK(content_type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA);
- permission_type = content::PermissionType::VIDEO_CAPTURE;
- }
-
+ content::PermissionType permission_type =
+ GetPermissionTypeForContentSettingsType(content_type);
if (ContentTypeIsRequested(permission_type, request)) {
DCHECK(content::IsOriginSecure(request_.security_origin) ||
request_.request_type == content::MEDIA_OPEN_DEVICE_PEPPER_ONLY);

Powered by Google App Engine
This is Rietveld 408576698