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 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 PrefService* prefs = profile_->GetPrefs(); | 467 PrefService* prefs = profile_->GetPrefs(); |
468 | 468 |
469 // TODO(tommi): Remove the kiosk mode check when the whitelist below | 469 // TODO(tommi): Remove the kiosk mode check when the whitelist below |
470 // is visible in the media exceptions UI. | 470 // is visible in the media exceptions UI. |
471 // See discussion here: https://codereview.chromium.org/15738004/ | 471 // See discussion here: https://codereview.chromium.org/15738004/ |
472 if (IsInKioskMode()) { | 472 if (IsInKioskMode()) { |
473 const base::ListValue* list = prefs->GetList(whitelist_policy_name); | 473 const base::ListValue* list = prefs->GetList(whitelist_policy_name); |
474 std::string value; | 474 std::string value; |
475 for (size_t i = 0; i < list->GetSize(); ++i) { | 475 for (size_t i = 0; i < list->GetSize(); ++i) { |
476 if (list->GetString(i, &value)) { | 476 if (list->GetString(i, &value)) { |
477 ContentSettingsPattern pattern = | 477 ContentSettingsPattern pattern = ContentSettingsPattern::FromString( |
478 ContentSettingsPattern::FromString(value); | 478 extensions::kExtensionScheme, value); |
479 if (pattern == ContentSettingsPattern::Wildcard()) { | 479 if (pattern == ContentSettingsPattern::Wildcard()) { |
480 DLOG(WARNING) << "Ignoring wildcard URL pattern: " << value; | 480 DLOG(WARNING) << "Ignoring wildcard URL pattern: " << value; |
481 continue; | 481 continue; |
482 } | 482 } |
483 DLOG_IF(ERROR, !pattern.IsValid()) << "Invalid URL pattern: " << value; | 483 DLOG_IF(ERROR, !pattern.IsValid()) << "Invalid URL pattern: " << value; |
484 if (pattern.IsValid() && pattern.Matches(request_.security_origin)) | 484 if (pattern.IsValid() && pattern.Matches(request_.security_origin)) |
485 return ALWAYS_ALLOW; | 485 return ALWAYS_ALLOW; |
486 } | 486 } |
487 } | 487 } |
488 } | 488 } |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 } | 676 } |
677 | 677 |
678 bool MediaStreamDevicesController::IsCaptureDeviceRequestAllowed() const { | 678 bool MediaStreamDevicesController::IsCaptureDeviceRequestAllowed() const { |
679 #if defined(OS_ANDROID) | 679 #if defined(OS_ANDROID) |
680 // Don't approve device requests if the tab was hidden. | 680 // Don't approve device requests if the tab was hidden. |
681 // TODO(qinmin): Add a test for this. http://crbug.com/396869. | 681 // TODO(qinmin): Add a test for this. http://crbug.com/396869. |
682 return web_contents_->GetRenderWidgetHostView()->IsShowing(); | 682 return web_contents_->GetRenderWidgetHostView()->IsShowing(); |
683 #endif | 683 #endif |
684 return true; | 684 return true; |
685 } | 685 } |
OLD | NEW |