Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5885)

Unified Diff: chrome/browser/media/media_stream_devices_controller.cc

Issue 1099453005: Switch web API/permission code to use IsOriginSecure() instead of SchemeIsSecure(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address nhiroki's comment. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/media/media_stream_devices_controller.cc
diff --git a/chrome/browser/media/media_stream_devices_controller.cc b/chrome/browser/media/media_stream_devices_controller.cc
index f6d6ecad7ea0e79e93979bfed0b560f1ee28260e..fe6054c5d9930599873757c45822bcc35817095b 100644
--- a/chrome/browser/media/media_stream_devices_controller.cc
+++ b/chrome/browser/media/media_stream_devices_controller.cc
@@ -15,6 +15,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/origin_util.h"
#include "chrome/common/pref_names.h"
#include "chrome/grit/generated_resources.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
@@ -382,7 +383,7 @@ void MediaStreamDevicesController::Accept(bool update_content_setting) {
// websites for Pepper requests as well. This is temporary and should be
// removed.
if (update_content_setting) {
- if ((IsSchemeSecure() && !devices.empty()) ||
+ if ((IsOriginSecure(request_.security_origin) && !devices.empty()) ||
request_.request_type == content::MEDIA_OPEN_DEVICE) {
StorePermission(true);
}
@@ -471,7 +472,7 @@ GURL MediaStreamDevicesController::GetRequestingHostname() const {
void MediaStreamDevicesController::PermissionGranted() {
GURL origin(GetSecurityOriginSpec());
- if (origin.SchemeIsSecure()) {
+ if (IsOriginSecure(origin)) {
UMA_HISTOGRAM_ENUMERATION("Media.DevicePermissionActions",
kAllowHttps, kPermissionActionsMax);
} else {
@@ -537,7 +538,7 @@ bool MediaStreamDevicesController::IsRequestAllowedByDefault() const {
if (policy == POLICY_NOT_SET) {
// Only load content settings from secure origins unless it is a
// content::MEDIA_OPEN_DEVICE (Pepper) request.
- if (!IsSchemeSecure() &&
+ if (!IsOriginSecure(request_.security_origin) &&
request_.request_type != content::MEDIA_OPEN_DEVICE) {
return false;
}
@@ -601,11 +602,6 @@ bool MediaStreamDevicesController::IsDefaultMediaAccessBlocked() const {
== CONTENT_SETTING_BLOCK);
}
-bool MediaStreamDevicesController::IsSchemeSecure() const {
- return request_.security_origin.SchemeIsSecure() ||
- request_.security_origin.SchemeIs(extensions::kExtensionScheme);
-}
-
void MediaStreamDevicesController::StorePermission(bool allowed) const {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
ContentSettingsPattern primary_pattern =

Powered by Google App Engine
This is Rietveld 408576698