| Index: chrome/browser/chromeos/login/ui/webui_login_view.cc
|
| diff --git a/chrome/browser/chromeos/login/ui/webui_login_view.cc b/chrome/browser/chromeos/login/ui/webui_login_view.cc
|
| index 172bd19d8e15d36c1a9a46d82d756bc011a578a8..a17616ba9376065daea537159979758239628ecc 100644
|
| --- a/chrome/browser/chromeos/login/ui/webui_login_view.cc
|
| +++ b/chrome/browser/chromeos/login/ui/webui_login_view.cc
|
| @@ -4,6 +4,8 @@
|
|
|
| #include "chrome/browser/chromeos/login/ui/webui_login_view.h"
|
|
|
| +#include <unordered_set>
|
| +
|
| #include "ash/common/focus_cycler.h"
|
| #include "ash/common/system/status_area_widget_delegate.h"
|
| #include "ash/common/system/tray/system_tray.h"
|
| @@ -28,7 +30,6 @@
|
| #include "chrome/browser/chromeos/login/ui/web_contents_set_background_color.h"
|
| #include "chrome/browser/chromeos/login/ui/webui_login_display.h"
|
| #include "chrome/browser/chromeos/profiles/profile_helper.h"
|
| -#include "chrome/browser/chromeos/settings/cros_settings.h"
|
| #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h"
|
| #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h"
|
| #include "chrome/browser/media/webrtc/media_stream_devices_controller.h"
|
| @@ -43,7 +44,6 @@
|
| #include "chromeos/dbus/session_manager_client.h"
|
| #include "chromeos/network/network_state.h"
|
| #include "chromeos/network/network_state_handler.h"
|
| -#include "chromeos/settings/cros_settings_names.h"
|
| #include "components/content_settings/core/common/content_settings_pattern.h"
|
| #include "components/password_manager/core/browser/password_manager.h"
|
| #include "components/web_modal/web_contents_modal_dialog_manager.h"
|
| @@ -117,6 +117,14 @@ ash::StatusAreaWidgetDelegate* GetStatusAreaWidgetDelegate() {
|
| : nullptr;
|
| }
|
|
|
| +std::unordered_set<const content::WebContentsDelegate*>*
|
| +GetWebUILoginViewSet() {
|
| + CR_DEFINE_STATIC_LOCAL(
|
| + std::unordered_set<const content::WebContentsDelegate*>,
|
| + g_webui_login_view_set, ());
|
| + return &g_webui_login_view_set;
|
| +}
|
| +
|
| } // namespace
|
|
|
| namespace chromeos {
|
| @@ -180,8 +188,17 @@ class WebUILoginView::StatusAreaFocusTraversable
|
|
|
| // WebUILoginView public: ------------------------------------------------------
|
|
|
| +// static
|
| +bool WebUILoginView::IsWebUILoginView(
|
| + const content::WebContentsDelegate* delegate) {
|
| + return base::ContainsKey(*GetWebUILoginViewSet(), delegate);
|
| +}
|
| +
|
| WebUILoginView::WebUILoginView(const WebViewSettings& settings)
|
| : settings_(settings) {
|
| + auto was_added = GetWebUILoginViewSet()->insert(this);
|
| + DCHECK(was_added.second);
|
| +
|
| registrar_.Add(this,
|
| chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE,
|
| content::NotificationService::AllSources());
|
| @@ -242,6 +259,9 @@ WebUILoginView::WebUILoginView(const WebViewSettings& settings)
|
| }
|
|
|
| WebUILoginView::~WebUILoginView() {
|
| + size_t num_removed = GetWebUILoginViewSet()->erase(this);
|
| + DCHECK_EQ(1u, num_removed);
|
| +
|
| for (auto& observer : observer_list_)
|
| observer.OnHostDestroying();
|
|
|
| @@ -562,46 +582,9 @@ void WebUILoginView::RequestMediaAccessPermission(
|
| WebContents* web_contents,
|
| const content::MediaStreamRequest& request,
|
| const content::MediaResponseCallback& callback) {
|
| + // Note: This is only needed for SAML logins.
|
| MediaStreamDevicesController controller(web_contents, request, callback);
|
| - if (!controller.IsAskingForAudio() && !controller.IsAskingForVideo())
|
| - return;
|
| -
|
| - if (controller.IsAskingForAudio()) {
|
| - controller.PermissionDenied();
|
| - return;
|
| - }
|
| -
|
| - const CrosSettings* const settings = CrosSettings::Get();
|
| - if (!settings) {
|
| - controller.PermissionDenied();
|
| - return;
|
| - }
|
| -
|
| - const base::Value* const raw_list_value =
|
| - settings->GetPref(kLoginVideoCaptureAllowedUrls);
|
| - if (!raw_list_value) {
|
| - controller.PermissionDenied();
|
| - return;
|
| - }
|
| -
|
| - const base::ListValue* list_value;
|
| - CHECK(raw_list_value->GetAsList(&list_value));
|
| - for (const auto& base_value : *list_value) {
|
| - std::string value;
|
| - if (base_value->GetAsString(&value)) {
|
| - ContentSettingsPattern pattern =
|
| - ContentSettingsPattern::FromString(value);
|
| - if (pattern == ContentSettingsPattern::Wildcard()) {
|
| - LOG(WARNING) << "Ignoring wildcard URL pattern: " << value;
|
| - continue;
|
| - }
|
| - if (pattern.IsValid() && pattern.Matches(request.security_origin)) {
|
| - controller.PermissionGranted();
|
| - return;
|
| - }
|
| - }
|
| - }
|
| - controller.PermissionDenied();
|
| + DCHECK(!controller.IsAskingForAudio() && !controller.IsAskingForVideo());
|
| }
|
|
|
| bool WebUILoginView::CheckMediaAccessPermission(
|
|
|