| 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/common/focus_cycler.h" | 7 #include "ash/common/focus_cycler.h" |
| 8 #include "ash/common/system/status_area_widget_delegate.h" | 8 #include "ash/common/system/status_area_widget_delegate.h" |
| 9 #include "ash/common/system/tray/system_tray.h" | 9 #include "ash/common/system/tray/system_tray.h" |
| 10 #include "ash/common/wm_shell.h" | 10 #include "ash/common/wm_shell.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" | 30 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" |
| 31 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 31 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 32 #include "chrome/browser/chromeos/settings/cros_settings.h" | 32 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 33 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" | 33 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" |
| 34 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" | 34 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" |
| 35 #include "chrome/browser/media/webrtc/media_stream_devices_controller.h" | 35 #include "chrome/browser/media/webrtc/media_stream_devices_controller.h" |
| 36 #include "chrome/browser/password_manager/chrome_password_manager_client.h" | 36 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
| 37 #include "chrome/browser/renderer_preferences_util.h" | 37 #include "chrome/browser/renderer_preferences_util.h" |
| 38 #include "chrome/browser/sessions/session_tab_helper.h" | 38 #include "chrome/browser/sessions/session_tab_helper.h" |
| 39 #include "chrome/browser/ui/ash/ash_util.h" | 39 #include "chrome/browser/ui/ash/ash_util.h" |
| 40 #include "chrome/browser/ui/ash/system_tray_client.h" |
| 40 #include "chrome/browser/ui/autofill/chrome_autofill_client.h" | 41 #include "chrome/browser/ui/autofill/chrome_autofill_client.h" |
| 41 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 42 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
| 42 #include "chromeos/dbus/dbus_thread_manager.h" | 43 #include "chromeos/dbus/dbus_thread_manager.h" |
| 43 #include "chromeos/dbus/session_manager_client.h" | 44 #include "chromeos/dbus/session_manager_client.h" |
| 44 #include "chromeos/network/network_state.h" | 45 #include "chromeos/network/network_state.h" |
| 45 #include "chromeos/network/network_state_handler.h" | 46 #include "chromeos/network/network_state_handler.h" |
| 46 #include "chromeos/settings/cros_settings_names.h" | 47 #include "chromeos/settings/cros_settings_names.h" |
| 47 #include "components/content_settings/core/common/content_settings_pattern.h" | 48 #include "components/content_settings/core/common/content_settings_pattern.h" |
| 48 #include "components/password_manager/core/browser/password_manager.h" | 49 #include "components/password_manager/core/browser/password_manager.h" |
| 49 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 50 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 *network, NULL, GetNativeWindow()); | 443 *network, NULL, GetNativeWindow()); |
| 443 dialog->Show(); | 444 dialog->Show(); |
| 444 } | 445 } |
| 445 | 446 |
| 446 void WebUILoginView::OnPostponedShow() { | 447 void WebUILoginView::OnPostponedShow() { |
| 447 set_is_hidden(false); | 448 set_is_hidden(false); |
| 448 OnLoginPromptVisible(); | 449 OnLoginPromptVisible(); |
| 449 } | 450 } |
| 450 | 451 |
| 451 void WebUILoginView::SetStatusAreaVisible(bool visible) { | 452 void WebUILoginView::SetStatusAreaVisible(bool visible) { |
| 452 if (!chrome::IsRunningInMash() && | 453 SystemTrayClient::Get()->SetPrimaryTrayVisible(visible); |
| 453 ash::Shell::GetInstance()->HasPrimaryStatusArea()) { | |
| 454 ash::SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray(); | |
| 455 tray->SetVisible(visible); | |
| 456 tray->GetWidget()->SetOpacity(visible ? 1.0 : 0.0); | |
| 457 if (visible) { | |
| 458 tray->GetWidget()->Show(); | |
| 459 } else { | |
| 460 tray->GetWidget()->Hide(); | |
| 461 } | |
| 462 } else { | |
| 463 NOTIMPLEMENTED(); | |
| 464 } | |
| 465 } | 454 } |
| 466 | 455 |
| 467 void WebUILoginView::SetUIEnabled(bool enabled) { | 456 void WebUILoginView::SetUIEnabled(bool enabled) { |
| 468 forward_keyboard_event_ = enabled; | 457 forward_keyboard_event_ = enabled; |
| 469 if (chrome::IsRunningInMash()) { | |
| 470 NOTIMPLEMENTED(); | |
| 471 return; | |
| 472 } | |
| 473 ash::SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray(); | |
| 474 | 458 |
| 475 // We disable the UI to prevent user from interracting with UI elements, | 459 SystemTrayClient::Get()->SetPrimaryTrayEnabled(enabled); |
| 476 // particullary with the system tray menu. However, in case if the system tray | |
| 477 // bubble is opened at this point, it remains opened and interactive even | |
| 478 // after SystemTray::SetEnabled(false) call, which can be dangerous | |
| 479 // (http://crbug.com/497080). Close the menu to fix it. Calling | |
| 480 // SystemTray::SetEnabled(false) guarantees, that the menu will not be opened | |
| 481 // until the UI is enabled again. | |
| 482 if (!enabled && tray->HasSystemBubble()) | |
| 483 tray->CloseSystemBubble(); | |
| 484 | |
| 485 tray->SetEnabled(enabled); | |
| 486 } | 460 } |
| 487 | 461 |
| 488 // WebUILoginView protected: --------------------------------------------------- | 462 // WebUILoginView protected: --------------------------------------------------- |
| 489 | 463 |
| 490 void WebUILoginView::Layout() { | 464 void WebUILoginView::Layout() { |
| 491 DCHECK(web_view()); | 465 DCHECK(web_view()); |
| 492 web_view()->SetBoundsRect(bounds()); | 466 web_view()->SetBoundsRect(bounds()); |
| 493 | 467 |
| 494 for (auto& observer : observer_list_) | 468 for (auto& observer : observer_list_) |
| 495 observer.OnPositionRequiresUpdate(); | 469 observer.OnPositionRequiresUpdate(); |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 if (should_emit_login_prompt_visible_) { | 636 if (should_emit_login_prompt_visible_) { |
| 663 VLOG(1) << "Login WebUI >> login-prompt-visible"; | 637 VLOG(1) << "Login WebUI >> login-prompt-visible"; |
| 664 chromeos::DBusThreadManager::Get()->GetSessionManagerClient()-> | 638 chromeos::DBusThreadManager::Get()->GetSessionManagerClient()-> |
| 665 EmitLoginPromptVisible(); | 639 EmitLoginPromptVisible(); |
| 666 } | 640 } |
| 667 | 641 |
| 668 webui_visible_ = true; | 642 webui_visible_ = true; |
| 669 } | 643 } |
| 670 | 644 |
| 671 } // namespace chromeos | 645 } // namespace chromeos |
| OLD | NEW |