Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chromeos/login/ui/webui_login_view.h" | 5 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/system/tray/system_tray.h" | 8 #include "ash/system/tray/system_tray.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 24 #include "chrome/browser/media/media_stream_devices_controller.h" | 24 #include "chrome/browser/media/media_stream_devices_controller.h" |
| 25 #include "chrome/browser/password_manager/chrome_password_manager_client.h" | 25 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
| 26 #include "chrome/browser/renderer_preferences_util.h" | 26 #include "chrome/browser/renderer_preferences_util.h" |
| 27 #include "chrome/browser/sessions/session_tab_helper.h" | 27 #include "chrome/browser/sessions/session_tab_helper.h" |
| 28 #include "chrome/browser/ui/autofill/chrome_autofill_client.h" | 28 #include "chrome/browser/ui/autofill/chrome_autofill_client.h" |
| 29 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 29 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
| 30 #include "chromeos/dbus/dbus_thread_manager.h" | 30 #include "chromeos/dbus/dbus_thread_manager.h" |
| 31 #include "chromeos/dbus/session_manager_client.h" | 31 #include "chromeos/dbus/session_manager_client.h" |
| 32 #include "chromeos/network/network_state.h" | 32 #include "chromeos/network/network_state.h" |
| 33 #include "chromeos/network/network_state_handler.h" | 33 #include "chromeos/network/network_state_handler.h" |
| 34 #include "chromeos/settings/cros_settings_names.h" | |
| 35 #include "components/content_settings/core/common/content_settings_pattern.h" | |
| 34 #include "components/password_manager/core/browser/password_manager.h" | 36 #include "components/password_manager/core/browser/password_manager.h" |
| 35 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 37 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
| 36 #include "content/public/browser/notification_service.h" | 38 #include "content/public/browser/notification_service.h" |
| 37 #include "content/public/browser/render_frame_host.h" | 39 #include "content/public/browser/render_frame_host.h" |
| 38 #include "content/public/browser/render_view_host.h" | 40 #include "content/public/browser/render_view_host.h" |
| 39 #include "content/public/browser/render_widget_host.h" | 41 #include "content/public/browser/render_widget_host.h" |
| 40 #include "content/public/browser/render_widget_host_view.h" | 42 #include "content/public/browser/render_widget_host_view.h" |
| 41 #include "content/public/browser/web_contents.h" | 43 #include "content/public/browser/web_contents.h" |
| 42 #include "content/public/browser/web_ui.h" | 44 #include "content/public/browser/web_ui.h" |
| 43 #include "content/public/common/renderer_preferences.h" | 45 #include "content/public/common/renderer_preferences.h" |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 428 } | 430 } |
| 429 | 431 |
| 430 return true; | 432 return true; |
| 431 } | 433 } |
| 432 | 434 |
| 433 void WebUILoginView::RequestMediaAccessPermission( | 435 void WebUILoginView::RequestMediaAccessPermission( |
| 434 WebContents* web_contents, | 436 WebContents* web_contents, |
| 435 const content::MediaStreamRequest& request, | 437 const content::MediaStreamRequest& request, |
| 436 const content::MediaResponseCallback& callback) { | 438 const content::MediaResponseCallback& callback) { |
| 437 MediaStreamDevicesController controller(web_contents, request, callback); | 439 MediaStreamDevicesController controller(web_contents, request, callback); |
| 438 if (controller.IsAskingForVideo() || controller.IsAskingForAudio()) | 440 if (controller.IsAskingForAudio() || !controller.IsAskingForVideo()) { |
| 439 NOTREACHED() << "Media stream not allowed for WebUI"; | 441 controller.PermissionDenied(); |
|
bartfab (slow)
2016/05/02 10:30:28
Nit: It would still make sense to have a NOTREACHE
Kevin Cernekee
2016/05/02 20:02:29
It isn't a Chrome bug (i.e. assertion failure) if
| |
| 442 return; | |
| 443 } | |
| 444 | |
| 445 chromeos::CrosSettings* settings = chromeos::CrosSettings::Get(); | |
|
bartfab (slow)
2016/05/02 10:30:28
Nit 1: const pointer.
Nit 2: #include "chrome/brow
Kevin Cernekee
2016/05/02 20:02:29
Done.
| |
| 446 if (!settings) { | |
| 447 controller.PermissionDenied(); | |
| 448 return; | |
| 449 } | |
| 450 | |
| 451 const base::Value* raw_types_value = | |
|
bartfab (slow)
2016/05/02 10:30:28
Nit: const pointer.
Kevin Cernekee
2016/05/02 20:02:29
Done.
| |
| 452 settings->GetPref(chromeos::kLoginVideoCaptureAllowedUrls); | |
|
bartfab (slow)
2016/05/02 10:30:28
Nit: s/chromeos:://
Kevin Cernekee
2016/05/02 20:02:29
Done.
| |
| 453 if (!raw_types_value) { | |
| 454 controller.PermissionDenied(); | |
| 455 return; | |
| 456 } | |
| 457 | |
| 458 const base::ListValue* types_value; | |
| 459 CHECK(raw_types_value->GetAsList(&types_value)); | |
|
bartfab (slow)
2016/05/02 10:30:28
Nit: #include "base/logging.h"
Kevin Cernekee
2016/05/02 20:02:29
Done.
| |
| 460 for (size_t i = 0; i < types_value->GetSize(); ++i) { | |
|
emaxx
2016/05/02 18:42:08
Nit: Range-based for loop?
Kevin Cernekee
2016/05/02 20:02:29
Done.
| |
| 461 std::string value; | |
| 462 if (types_value->GetString(i, &value)) { | |
| 463 ContentSettingsPattern pattern = | |
| 464 ContentSettingsPattern::FromString(value); | |
| 465 if (pattern == ContentSettingsPattern::Wildcard()) { | |
| 466 LOG(WARNING) << "Ignoring wildcard URL pattern: " << value; | |
| 467 continue; | |
| 468 } | |
| 469 if (pattern.IsValid() && pattern.Matches(request.security_origin)) { | |
| 470 controller.PermissionGranted(); | |
| 471 return; | |
| 472 } | |
| 473 } | |
| 474 } | |
| 475 controller.PermissionDenied(); | |
| 440 } | 476 } |
| 441 | 477 |
| 442 bool WebUILoginView::CheckMediaAccessPermission( | 478 bool WebUILoginView::CheckMediaAccessPermission( |
| 443 content::WebContents* web_contents, | 479 content::WebContents* web_contents, |
| 444 const GURL& security_origin, | 480 const GURL& security_origin, |
| 445 content::MediaStreamType type) { | 481 content::MediaStreamType type) { |
| 446 return MediaCaptureDevicesDispatcher::GetInstance() | 482 return MediaCaptureDevicesDispatcher::GetInstance() |
| 447 ->CheckMediaAccessPermission(web_contents, security_origin, type); | 483 ->CheckMediaAccessPermission(web_contents, security_origin, type); |
| 448 } | 484 } |
| 449 | 485 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 496 if (should_emit_login_prompt_visible_) { | 532 if (should_emit_login_prompt_visible_) { |
| 497 VLOG(1) << "Login WebUI >> login-prompt-visible"; | 533 VLOG(1) << "Login WebUI >> login-prompt-visible"; |
| 498 chromeos::DBusThreadManager::Get()->GetSessionManagerClient()-> | 534 chromeos::DBusThreadManager::Get()->GetSessionManagerClient()-> |
| 499 EmitLoginPromptVisible(); | 535 EmitLoginPromptVisible(); |
| 500 } | 536 } |
| 501 | 537 |
| 502 webui_visible_ = true; | 538 webui_visible_ = true; |
| 503 } | 539 } |
| 504 | 540 |
| 505 } // namespace chromeos | 541 } // namespace chromeos |
| OLD | NEW |