| 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/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/prefs/scoped_user_pref_update.h" | 9 #include "base/prefs/scoped_user_pref_update.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 // TODO(markusheintz): Replace CONTENT_SETTINGS_TYPE_MEDIA_STREAM with the | 480 // TODO(markusheintz): Replace CONTENT_SETTINGS_TYPE_MEDIA_STREAM with the |
| 481 // appropriate new CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC and | 481 // appropriate new CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC and |
| 482 // CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA. | 482 // CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA. |
| 483 return profile_->GetHostContentSettingsMap()->ShouldAllowAllContent( | 483 return profile_->GetHostContentSettingsMap()->ShouldAllowAllContent( |
| 484 request_.security_origin, request_.security_origin, | 484 request_.security_origin, request_.security_origin, |
| 485 CONTENT_SETTINGS_TYPE_MEDIASTREAM); | 485 CONTENT_SETTINGS_TYPE_MEDIASTREAM); |
| 486 } | 486 } |
| 487 | 487 |
| 488 void MediaStreamDevicesController::SetPermission(bool allowed) const { | 488 void MediaStreamDevicesController::SetPermission(bool allowed) const { |
| 489 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 489 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 490 #if defined(OS_ANDROID) | |
| 491 // We do not support sticky operations on Android yet. | |
| 492 return; | |
| 493 #endif | |
| 494 ContentSettingsPattern primary_pattern = | 490 ContentSettingsPattern primary_pattern = |
| 495 ContentSettingsPattern::FromURLNoWildcard(request_.security_origin); | 491 ContentSettingsPattern::FromURLNoWildcard(request_.security_origin); |
| 496 // Check the pattern is valid or not. When the request is from a file access, | 492 // Check the pattern is valid or not. When the request is from a file access, |
| 497 // no exception will be made. | 493 // no exception will be made. |
| 498 if (!primary_pattern.IsValid()) | 494 if (!primary_pattern.IsValid()) |
| 499 return; | 495 return; |
| 500 | 496 |
| 501 ContentSetting content_setting = allowed ? | 497 ContentSetting content_setting = allowed ? |
| 502 CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; | 498 CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; |
| 503 if (request_permissions_.find(content::MEDIA_DEVICE_AUDIO_CAPTURE) != | 499 if (request_permissions_.find(content::MEDIA_DEVICE_AUDIO_CAPTURE) != |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 it->second.permission == MEDIA_ALLOWED); | 549 it->second.permission == MEDIA_ALLOWED); |
| 554 } | 550 } |
| 555 | 551 |
| 556 bool MediaStreamDevicesController::IsDeviceVideoCaptureRequestedAndAllowed() | 552 bool MediaStreamDevicesController::IsDeviceVideoCaptureRequestedAndAllowed() |
| 557 const { | 553 const { |
| 558 MediaStreamTypeSettingsMap::const_iterator it = | 554 MediaStreamTypeSettingsMap::const_iterator it = |
| 559 request_permissions_.find(content::MEDIA_DEVICE_VIDEO_CAPTURE); | 555 request_permissions_.find(content::MEDIA_DEVICE_VIDEO_CAPTURE); |
| 560 return (it != request_permissions_.end() && | 556 return (it != request_permissions_.end() && |
| 561 it->second.permission == MEDIA_ALLOWED); | 557 it->second.permission == MEDIA_ALLOWED); |
| 562 } | 558 } |
| OLD | NEW |