| 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 13 matching lines...) Expand all Loading... |
| 24 #include "components/pref_registry/pref_registry_syncable.h" | 24 #include "components/pref_registry/pref_registry_syncable.h" |
| 25 #include "content/public/browser/browser_thread.h" | 25 #include "content/public/browser/browser_thread.h" |
| 26 #include "content/public/browser/render_widget_host_view.h" | 26 #include "content/public/browser/render_widget_host_view.h" |
| 27 #include "content/public/common/media_stream_request.h" | 27 #include "content/public/common/media_stream_request.h" |
| 28 #include "extensions/common/constants.h" | 28 #include "extensions/common/constants.h" |
| 29 #include "grit/generated_resources.h" | 29 #include "grit/generated_resources.h" |
| 30 #include "grit/theme_resources.h" | 30 #include "grit/theme_resources.h" |
| 31 #include "ui/base/l10n/l10n_util.h" | 31 #include "ui/base/l10n/l10n_util.h" |
| 32 | 32 |
| 33 #if defined(OS_CHROMEOS) | 33 #if defined(OS_CHROMEOS) |
| 34 #include "chrome/browser/chromeos/login/users/user_manager.h" | 34 #include "components/user_manager/user_manager.h" |
| 35 #endif | 35 #endif |
| 36 | 36 |
| 37 using content::BrowserThread; | 37 using content::BrowserThread; |
| 38 | 38 |
| 39 namespace { | 39 namespace { |
| 40 | 40 |
| 41 bool HasAvailableDevicesForRequest(const content::MediaStreamRequest& request) { | 41 bool HasAvailableDevicesForRequest(const content::MediaStreamRequest& request) { |
| 42 const content::MediaStreamDevices* audio_devices = | 42 const content::MediaStreamDevices* audio_devices = |
| 43 request.audio_type == content::MEDIA_DEVICE_AUDIO_CAPTURE ? | 43 request.audio_type == content::MEDIA_DEVICE_AUDIO_CAPTURE ? |
| 44 &MediaCaptureDevicesDispatcher::GetInstance() | 44 &MediaCaptureDevicesDispatcher::GetInstance() |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 } | 79 } |
| 80 | 80 |
| 81 return true; | 81 return true; |
| 82 } | 82 } |
| 83 | 83 |
| 84 bool IsInKioskMode() { | 84 bool IsInKioskMode() { |
| 85 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode)) | 85 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode)) |
| 86 return true; | 86 return true; |
| 87 | 87 |
| 88 #if defined(OS_CHROMEOS) | 88 #if defined(OS_CHROMEOS) |
| 89 const chromeos::UserManager* user_manager = chromeos::UserManager::Get(); | 89 const user_manager::UserManager* user_manager = |
| 90 user_manager::UserManager::Get(); |
| 90 return user_manager && user_manager->IsLoggedInAsKioskApp(); | 91 return user_manager && user_manager->IsLoggedInAsKioskApp(); |
| 91 #else | 92 #else |
| 92 return false; | 93 return false; |
| 93 #endif | 94 #endif |
| 94 } | 95 } |
| 95 | 96 |
| 96 enum DevicePermissionActions { | 97 enum DevicePermissionActions { |
| 97 kAllowHttps = 0, | 98 kAllowHttps = 0, |
| 98 kAllowHttp, | 99 kAllowHttp, |
| 99 kDeny, | 100 kDeny, |
| (...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 } | 677 } |
| 677 | 678 |
| 678 bool MediaStreamDevicesController::IsCaptureDeviceRequestAllowed() const { | 679 bool MediaStreamDevicesController::IsCaptureDeviceRequestAllowed() const { |
| 679 #if defined(OS_ANDROID) | 680 #if defined(OS_ANDROID) |
| 680 // Don't approve device requests if the tab was hidden. | 681 // Don't approve device requests if the tab was hidden. |
| 681 // TODO(qinmin): Add a test for this. http://crbug.com/396869. | 682 // TODO(qinmin): Add a test for this. http://crbug.com/396869. |
| 682 return web_contents_->GetRenderWidgetHostView()->IsShowing(); | 683 return web_contents_->GetRenderWidgetHostView()->IsShowing(); |
| 683 #endif | 684 #endif |
| 684 return true; | 685 return true; |
| 685 } | 686 } |
| OLD | NEW |