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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 message_id = IDS_MEDIA_CAPTURE_VIDEO_ONLY_PERMISSION_FRAGMENT; | 268 message_id = IDS_MEDIA_CAPTURE_VIDEO_ONLY_PERMISSION_FRAGMENT; |
269 else if (!IsAskingForVideo()) | 269 else if (!IsAskingForVideo()) |
270 message_id = IDS_MEDIA_CAPTURE_AUDIO_ONLY_PERMISSION_FRAGMENT; | 270 message_id = IDS_MEDIA_CAPTURE_AUDIO_ONLY_PERMISSION_FRAGMENT; |
271 return l10n_util::GetStringUTF16(message_id); | 271 return l10n_util::GetStringUTF16(message_id); |
272 } | 272 } |
273 | 273 |
274 bool MediaStreamDevicesController::HasUserGesture() const { | 274 bool MediaStreamDevicesController::HasUserGesture() const { |
275 return request_.user_gesture; | 275 return request_.user_gesture; |
276 } | 276 } |
277 | 277 |
278 GURL MediaStreamDevicesController::GetRequestingHostname() const { | 278 GURL MediaStreamDevicesController::GetOrigin() const { |
279 return request_.security_origin; | 279 return request_.security_origin; |
280 } | 280 } |
281 | 281 |
282 void MediaStreamDevicesController::PermissionGranted() { | 282 void MediaStreamDevicesController::PermissionGranted() { |
283 RecordPermissionAction( | 283 RecordPermissionAction( |
284 request_, base::Bind(PermissionUmaUtil::PermissionGranted)); | 284 request_, base::Bind(PermissionUmaUtil::PermissionGranted)); |
285 RunCallback(GetNewSetting(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, | 285 RunCallback(GetNewSetting(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, |
286 old_audio_setting_, CONTENT_SETTING_ALLOW), | 286 old_audio_setting_, CONTENT_SETTING_ALLOW), |
287 GetNewSetting(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, | 287 GetNewSetting(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, |
288 old_video_setting_, CONTENT_SETTING_ALLOW), | 288 old_video_setting_, CONTENT_SETTING_ALLOW), |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 if (android_permission_blocked) | 615 if (android_permission_blocked) |
616 return false; | 616 return false; |
617 | 617 |
618 // Don't approve device requests if the tab was hidden. | 618 // Don't approve device requests if the tab was hidden. |
619 // TODO(qinmin): Add a test for this. http://crbug.com/396869. | 619 // TODO(qinmin): Add a test for this. http://crbug.com/396869. |
620 // TODO(raymes): Shouldn't this apply to all permissions not just audio/video? | 620 // TODO(raymes): Shouldn't this apply to all permissions not just audio/video? |
621 return web_contents_->GetRenderWidgetHostView()->IsShowing(); | 621 return web_contents_->GetRenderWidgetHostView()->IsShowing(); |
622 #endif | 622 #endif |
623 return true; | 623 return true; |
624 } | 624 } |
OLD | NEW |