| 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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 SetPermission(false); | 386 SetPermission(false); |
| 387 } | 387 } |
| 388 | 388 |
| 389 content::MediaResponseCallback cb = callback_; | 389 content::MediaResponseCallback cb = callback_; |
| 390 callback_.Reset(); | 390 callback_.Reset(); |
| 391 cb.Run(content::MediaStreamDevices(), | 391 cb.Run(content::MediaStreamDevices(), |
| 392 result, | 392 result, |
| 393 scoped_ptr<content::MediaStreamUI>()); | 393 scoped_ptr<content::MediaStreamUI>()); |
| 394 } | 394 } |
| 395 | 395 |
| 396 PermissionBubbleRequest::Type MediaStreamDevicesController::GetType() const { |
| 397 return PermissionBubbleRequest::Type::kMedia; |
| 398 } |
| 399 |
| 396 int MediaStreamDevicesController::GetIconID() const { | 400 int MediaStreamDevicesController::GetIconID() const { |
| 397 if (HasVideo()) | 401 if (HasVideo()) |
| 398 return IDR_INFOBAR_MEDIA_STREAM_CAMERA; | 402 return IDR_INFOBAR_MEDIA_STREAM_CAMERA; |
| 399 | 403 |
| 400 return IDR_INFOBAR_MEDIA_STREAM_MIC; | 404 return IDR_INFOBAR_MEDIA_STREAM_MIC; |
| 401 } | 405 } |
| 402 | 406 |
| 403 base::string16 MediaStreamDevicesController::GetMessageText() const { | 407 base::string16 MediaStreamDevicesController::GetMessageText() const { |
| 404 int message_id = IDS_MEDIA_CAPTURE_AUDIO_AND_VIDEO; | 408 int message_id = IDS_MEDIA_CAPTURE_AUDIO_AND_VIDEO; |
| 405 if (!HasAudio()) | 409 if (!HasAudio()) |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 } | 680 } |
| 677 | 681 |
| 678 bool MediaStreamDevicesController::IsCaptureDeviceRequestAllowed() const { | 682 bool MediaStreamDevicesController::IsCaptureDeviceRequestAllowed() const { |
| 679 #if defined(OS_ANDROID) | 683 #if defined(OS_ANDROID) |
| 680 // Don't approve device requests if the tab was hidden. | 684 // Don't approve device requests if the tab was hidden. |
| 681 // TODO(qinmin): Add a test for this. http://crbug.com/396869. | 685 // TODO(qinmin): Add a test for this. http://crbug.com/396869. |
| 682 return web_contents_->GetRenderWidgetHostView()->IsShowing(); | 686 return web_contents_->GetRenderWidgetHostView()->IsShowing(); |
| 683 #endif | 687 #endif |
| 684 return true; | 688 return true; |
| 685 } | 689 } |
| OLD | NEW |