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

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

Issue 2307083002: Cleanup: move WebRTC related files from chrome/browser/media to chrome/browser/media/webrtc/ (Closed)
Patch Set: Removed file wrongly resuscitated during rebase Created 4 years, 3 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_device_permissions.cc
diff --git a/chrome/browser/media/media_stream_device_permissions.cc b/chrome/browser/media/media_stream_device_permissions.cc
deleted file mode 100644
index 26cc93aacba90b9cfa807ab794071d1947f84d7f..0000000000000000000000000000000000000000
--- a/chrome/browser/media/media_stream_device_permissions.cc
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/media/media_stream_device_permissions.h"
-
-#include <stddef.h>
-
-#include "base/values.h"
-#include "chrome/browser/profiles/profile.h"
-#include "components/content_settings/core/browser/host_content_settings_map.h"
-#include "components/content_settings/core/common/content_settings_pattern.h"
-#include "components/prefs/pref_service.h"
-#include "content/public/browser/browser_thread.h"
-#include "content/public/common/origin_util.h"
-#include "extensions/common/constants.h"
-#include "url/gurl.h"
-
-MediaStreamDevicePolicy GetDevicePolicy(const Profile* profile,
- const GURL& security_origin,
- const char* policy_name,
- const char* whitelist_policy_name) {
- DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
-
- // If the security origin policy matches a value in the whitelist, allow it.
- // Otherwise, check the |policy_name| master switch for the default behavior.
-
- const PrefService* prefs = profile->GetPrefs();
-
- const base::ListValue* list = prefs->GetList(whitelist_policy_name);
- std::string value;
- for (size_t i = 0; i < list->GetSize(); ++i) {
- if (list->GetString(i, &value)) {
- ContentSettingsPattern pattern =
- ContentSettingsPattern::FromString(value);
- if (pattern == ContentSettingsPattern::Wildcard()) {
- DLOG(WARNING) << "Ignoring wildcard URL pattern: " << value;
- continue;
- }
- DLOG_IF(ERROR, !pattern.IsValid()) << "Invalid URL pattern: " << value;
- if (pattern.IsValid() && pattern.Matches(security_origin))
- return ALWAYS_ALLOW;
- }
- }
-
- // If a match was not found, check if audio capture is otherwise disallowed
- // or if the user should be prompted. Setting the policy value to "true"
- // is equal to not setting it at all, so from hereon out, we will return
- // either POLICY_NOT_SET (prompt) or ALWAYS_DENY (no prompt, no access).
- if (!prefs->GetBoolean(policy_name))
- return ALWAYS_DENY;
-
- return POLICY_NOT_SET;
-}
« no previous file with comments | « chrome/browser/media/media_stream_device_permissions.h ('k') | chrome/browser/media/media_stream_devices_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698