| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/prefs/scoped_user_pref_update.h" | 10 #include "base/prefs/scoped_user_pref_update.h" |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 base::string16 MediaStreamDevicesController::GetMessageTextFragment() const { | 381 base::string16 MediaStreamDevicesController::GetMessageTextFragment() const { |
| 382 int message_id = IDS_MEDIA_CAPTURE_AUDIO_AND_VIDEO_PERMISSION_FRAGMENT; | 382 int message_id = IDS_MEDIA_CAPTURE_AUDIO_AND_VIDEO_PERMISSION_FRAGMENT; |
| 383 if (!HasAudio()) | 383 if (!HasAudio()) |
| 384 message_id = IDS_MEDIA_CAPTURE_VIDEO_ONLY_PERMISSION_FRAGMENT; | 384 message_id = IDS_MEDIA_CAPTURE_VIDEO_ONLY_PERMISSION_FRAGMENT; |
| 385 else if (!HasVideo()) | 385 else if (!HasVideo()) |
| 386 message_id = IDS_MEDIA_CAPTURE_AUDIO_ONLY_PERMISSION_FRAGMENT; | 386 message_id = IDS_MEDIA_CAPTURE_AUDIO_ONLY_PERMISSION_FRAGMENT; |
| 387 return l10n_util::GetStringUTF16(message_id); | 387 return l10n_util::GetStringUTF16(message_id); |
| 388 } | 388 } |
| 389 | 389 |
| 390 bool MediaStreamDevicesController::HasUserGesture() const { | 390 bool MediaStreamDevicesController::HasUserGesture() const { |
| 391 // TODO(gbillock): plumb this through | 391 return request_.user_gesture; |
| 392 return false; | |
| 393 } | 392 } |
| 394 | 393 |
| 395 GURL MediaStreamDevicesController::GetRequestingHostname() const { | 394 GURL MediaStreamDevicesController::GetRequestingHostname() const { |
| 396 return request_.security_origin; | 395 return request_.security_origin; |
| 397 } | 396 } |
| 398 | 397 |
| 399 void MediaStreamDevicesController::PermissionGranted() { | 398 void MediaStreamDevicesController::PermissionGranted() { |
| 400 GURL origin(GetSecurityOriginSpec()); | 399 GURL origin(GetSecurityOriginSpec()); |
| 401 if (origin.SchemeIsSecure()) { | 400 if (origin.SchemeIsSecure()) { |
| 402 UMA_HISTOGRAM_ENUMERATION("Media.DevicePermissionActions", | 401 UMA_HISTOGRAM_ENUMERATION("Media.DevicePermissionActions", |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 it->second.permission == MEDIA_ALLOWED); | 637 it->second.permission == MEDIA_ALLOWED); |
| 639 } | 638 } |
| 640 | 639 |
| 641 bool MediaStreamDevicesController::IsDeviceVideoCaptureRequestedAndAllowed() | 640 bool MediaStreamDevicesController::IsDeviceVideoCaptureRequestedAndAllowed() |
| 642 const { | 641 const { |
| 643 MediaStreamTypeSettingsMap::const_iterator it = | 642 MediaStreamTypeSettingsMap::const_iterator it = |
| 644 request_permissions_.find(content::MEDIA_DEVICE_VIDEO_CAPTURE); | 643 request_permissions_.find(content::MEDIA_DEVICE_VIDEO_CAPTURE); |
| 645 return (it != request_permissions_.end() && | 644 return (it != request_permissions_.end() && |
| 646 it->second.permission == MEDIA_ALLOWED); | 645 it->second.permission == MEDIA_ALLOWED); |
| 647 } | 646 } |
| OLD | NEW |