OLD | NEW |
---|---|
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 Loading... | |
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, bool, const GURL&, Profile*)>; |
76 | 76 |
77 void RecordSinglePermissionAction(const content::MediaStreamRequest& request, | 77 void RecordSinglePermissionAction(const content::MediaStreamRequest& request, |
78 content::PermissionType permission_type, | 78 content::PermissionType permission_type, |
79 Profile* profile, | 79 Profile* profile, |
80 PermissionActionCallback callback) { | 80 PermissionActionCallback callback) { |
81 if (ContentTypeIsRequested(permission_type, request)) { | 81 if (ContentTypeIsRequested(permission_type, request)) { |
82 callback.Run(permission_type, request.security_origin, profile); | 82 callback.Run(permission_type, false /* user_gesture */, |
raymes
2016/07/18 00:58:43
Do we need to add a comment that this needs to be
stefanocs
2016/07/18 04:28:44
Done.
| |
83 request.security_origin, profile); | |
83 } | 84 } |
84 } | 85 } |
85 | 86 |
86 // Calls |action_function| for each permission requested by |request|. | 87 // Calls |action_function| for each permission requested by |request|. |
87 void RecordPermissionAction(const content::MediaStreamRequest& request, | 88 void RecordPermissionAction(const content::MediaStreamRequest& request, |
88 Profile* profile, | 89 Profile* profile, |
89 PermissionActionCallback callback) { | 90 PermissionActionCallback callback) { |
90 RecordSinglePermissionAction(request, content::PermissionType::AUDIO_CAPTURE, | 91 RecordSinglePermissionAction(request, content::PermissionType::AUDIO_CAPTURE, |
91 profile, callback); | 92 profile, callback); |
92 RecordSinglePermissionAction(request, content::PermissionType::VIDEO_CAPTURE, | 93 RecordSinglePermissionAction(request, content::PermissionType::VIDEO_CAPTURE, |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
634 if (android_permission_blocked) | 635 if (android_permission_blocked) |
635 return false; | 636 return false; |
636 | 637 |
637 // Don't approve device requests if the tab was hidden. | 638 // Don't approve device requests if the tab was hidden. |
638 // TODO(qinmin): Add a test for this. http://crbug.com/396869. | 639 // 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? | 640 // TODO(raymes): Shouldn't this apply to all permissions not just audio/video? |
640 return web_contents_->GetRenderWidgetHostView()->IsShowing(); | 641 return web_contents_->GetRenderWidgetHostView()->IsShowing(); |
641 #endif | 642 #endif |
642 return true; | 643 return true; |
643 } | 644 } |
OLD | NEW |