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

Side by Side Diff: chrome/browser/media/media_stream_devices_controller.cc

Issue 2153133002: Add gesture type value from desktop prompt to permission report (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@add-user-gesture-to-reporting-part
Patch Set: nit 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "chrome/browser/media/media_stream_devices_controller.h" 5 #include "chrome/browser/media/media_stream_devices_controller.h"
6 6
7 #include <map> 7 #include <map>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 if (type == content::PermissionType::AUDIO_CAPTURE) 65 if (type == content::PermissionType::AUDIO_CAPTURE)
66 return request.audio_type == content::MEDIA_DEVICE_AUDIO_CAPTURE; 66 return request.audio_type == content::MEDIA_DEVICE_AUDIO_CAPTURE;
67 67
68 if (type == content::PermissionType::VIDEO_CAPTURE) 68 if (type == content::PermissionType::VIDEO_CAPTURE)
69 return request.video_type == content::MEDIA_DEVICE_VIDEO_CAPTURE; 69 return request.video_type == content::MEDIA_DEVICE_VIDEO_CAPTURE;
70 70
71 return false; 71 return false;
72 } 72 }
73 73
74 using PermissionActionCallback = 74 using PermissionActionCallback =
75 base::Callback<void(content::PermissionType, const GURL&, Profile*)>; 75 base::Callback<void(content::PermissionType,
76 PermissionRequestGestureType,
77 const GURL&,
78 Profile*)>;
76 79
77 void RecordSinglePermissionAction(const content::MediaStreamRequest& request, 80 void RecordSinglePermissionAction(const content::MediaStreamRequest& request,
78 content::PermissionType permission_type, 81 content::PermissionType permission_type,
79 Profile* profile, 82 Profile* profile,
80 PermissionActionCallback callback) { 83 PermissionActionCallback callback) {
81 if (ContentTypeIsRequested(permission_type, request)) { 84 if (ContentTypeIsRequested(permission_type, request)) {
82 callback.Run(permission_type, request.security_origin, profile); 85 // TODO(stefanocs): Pass the actual |gesture_type| once this file has been
86 // refactored into PermissionContext.
87 callback.Run(permission_type, PermissionRequestGestureType::UNKNOWN,
88 request.security_origin, profile);
83 } 89 }
84 } 90 }
85 91
86 // Calls |action_function| for each permission requested by |request|. 92 // Calls |action_function| for each permission requested by |request|.
87 void RecordPermissionAction(const content::MediaStreamRequest& request, 93 void RecordPermissionAction(const content::MediaStreamRequest& request,
88 Profile* profile, 94 Profile* profile,
89 PermissionActionCallback callback) { 95 PermissionActionCallback callback) {
90 RecordSinglePermissionAction(request, content::PermissionType::AUDIO_CAPTURE, 96 RecordSinglePermissionAction(request, content::PermissionType::AUDIO_CAPTURE,
91 profile, callback); 97 profile, callback);
92 RecordSinglePermissionAction(request, content::PermissionType::VIDEO_CAPTURE, 98 RecordSinglePermissionAction(request, content::PermissionType::VIDEO_CAPTURE,
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 if (android_permission_blocked) 640 if (android_permission_blocked)
635 return false; 641 return false;
636 642
637 // Don't approve device requests if the tab was hidden. 643 // Don't approve device requests if the tab was hidden.
638 // TODO(qinmin): Add a test for this. http://crbug.com/396869. 644 // TODO(qinmin): Add a test for this. http://crbug.com/396869.
639 // TODO(raymes): Shouldn't this apply to all permissions not just audio/video? 645 // TODO(raymes): Shouldn't this apply to all permissions not just audio/video?
640 return web_contents_->GetRenderWidgetHostView()->IsShowing(); 646 return web_contents_->GetRenderWidgetHostView()->IsShowing();
641 #endif 647 #endif
642 return true; 648 return true;
643 } 649 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698