| 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/login_display_host_impl.h" | 5 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/public/cpp/shell_window_ids.h" | 10 #include "ash/public/cpp/shell_window_ids.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 #include "services/ui/public/cpp/property_type_converters.h" | 90 #include "services/ui/public/cpp/property_type_converters.h" |
| 91 #include "services/ui/public/interfaces/window_manager.mojom.h" | 91 #include "services/ui/public/interfaces/window_manager.mojom.h" |
| 92 #include "ui/aura/window.h" | 92 #include "ui/aura/window.h" |
| 93 #include "ui/base/ime/chromeos/extension_ime_util.h" | 93 #include "ui/base/ime/chromeos/extension_ime_util.h" |
| 94 #include "ui/base/ime/chromeos/input_method_manager.h" | 94 #include "ui/base/ime/chromeos/input_method_manager.h" |
| 95 #include "ui/base/l10n/l10n_util.h" | 95 #include "ui/base/l10n/l10n_util.h" |
| 96 #include "ui/base/resource/resource_bundle.h" | 96 #include "ui/base/resource/resource_bundle.h" |
| 97 #include "ui/compositor/layer.h" | 97 #include "ui/compositor/layer.h" |
| 98 #include "ui/compositor/layer_animation_observer.h" | 98 #include "ui/compositor/layer_animation_observer.h" |
| 99 #include "ui/compositor/scoped_layer_animation_settings.h" | 99 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 100 #include "ui/display/display.h" | |
| 101 #include "ui/display/screen.h" | |
| 102 #include "ui/events/event_handler.h" | 100 #include "ui/events/event_handler.h" |
| 103 #include "ui/events/event_utils.h" | 101 #include "ui/events/event_utils.h" |
| 104 #include "ui/gfx/geometry/rect.h" | 102 #include "ui/gfx/geometry/rect.h" |
| 105 #include "ui/gfx/geometry/size.h" | 103 #include "ui/gfx/geometry/size.h" |
| 106 #include "ui/gfx/transform.h" | 104 #include "ui/gfx/transform.h" |
| 107 #include "ui/keyboard/keyboard_controller.h" | 105 #include "ui/keyboard/keyboard_controller.h" |
| 108 #include "ui/keyboard/keyboard_util.h" | 106 #include "ui/keyboard/keyboard_util.h" |
| 109 #include "ui/views/focus/focus_manager.h" | 107 #include "ui/views/focus/focus_manager.h" |
| 110 #include "ui/views/widget/widget.h" | 108 #include "ui/views/widget/widget.h" |
| 111 #include "ui/views/widget/widget_delegate.h" | 109 #include "ui/views/widget/widget_delegate.h" |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 animation_weak_ptr_factory_(this) { | 363 animation_weak_ptr_factory_(this) { |
| 366 if (ash_util::IsRunningInMash()) { | 364 if (ash_util::IsRunningInMash()) { |
| 367 // Animation, and initializing hidden, are not currently supported for Mash. | 365 // Animation, and initializing hidden, are not currently supported for Mash. |
| 368 finalize_animation_type_ = ANIMATION_NONE; | 366 finalize_animation_type_ = ANIMATION_NONE; |
| 369 initialize_webui_hidden_ = false; | 367 initialize_webui_hidden_ = false; |
| 370 } | 368 } |
| 371 | 369 |
| 372 DBusThreadManager::Get()->GetSessionManagerClient()->AddObserver(this); | 370 DBusThreadManager::Get()->GetSessionManagerClient()->AddObserver(this); |
| 373 CrasAudioHandler::Get()->AddAudioObserver(this); | 371 CrasAudioHandler::Get()->AddAudioObserver(this); |
| 374 | 372 |
| 375 display::Screen::GetScreen()->AddObserver(this); | |
| 376 | 373 |
| 377 // We need to listen to CLOSE_ALL_BROWSERS_REQUEST but not APP_TERMINATING | 374 // We need to listen to CLOSE_ALL_BROWSERS_REQUEST but not APP_TERMINATING |
| 378 // because/ APP_TERMINATING will never be fired as long as this keeps | 375 // because/ APP_TERMINATING will never be fired as long as this keeps |
| 379 // ref-count. CLOSE_ALL_BROWSERS_REQUEST is safe here because there will be no | 376 // ref-count. CLOSE_ALL_BROWSERS_REQUEST is safe here because there will be no |
| 380 // browser instance that will block the shutdown. | 377 // browser instance that will block the shutdown. |
| 381 registrar_.Add(this, | 378 registrar_.Add(this, |
| 382 chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST, | 379 chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST, |
| 383 content::NotificationService::AllSources()); | 380 content::NotificationService::AllSources()); |
| 384 | 381 |
| 385 // NOTIFICATION_BROWSER_OPENED is issued after browser is created, but | 382 // NOTIFICATION_BROWSER_OPENED is issued after browser is created, but |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 scoped_drag_drop_disabler_.reset(new aura::client::ScopedDragDropDisabler( | 472 scoped_drag_drop_disabler_.reset(new aura::client::ScopedDragDropDisabler( |
| 476 ash::Shell::GetPrimaryRootWindow())); | 473 ash::Shell::GetPrimaryRootWindow())); |
| 477 } else { | 474 } else { |
| 478 NOTIMPLEMENTED(); | 475 NOTIMPLEMENTED(); |
| 479 } | 476 } |
| 480 } | 477 } |
| 481 | 478 |
| 482 LoginDisplayHostImpl::~LoginDisplayHostImpl() { | 479 LoginDisplayHostImpl::~LoginDisplayHostImpl() { |
| 483 DBusThreadManager::Get()->GetSessionManagerClient()->RemoveObserver(this); | 480 DBusThreadManager::Get()->GetSessionManagerClient()->RemoveObserver(this); |
| 484 CrasAudioHandler::Get()->RemoveAudioObserver(this); | 481 CrasAudioHandler::Get()->RemoveAudioObserver(this); |
| 485 display::Screen::GetScreen()->RemoveObserver(this); | |
| 486 | 482 |
| 487 if (login_view_ && login_window_) | 483 if (login_view_ && login_window_) |
| 488 login_window_->RemoveRemovalsObserver(this); | 484 login_window_->RemoveRemovalsObserver(this); |
| 489 | 485 |
| 490 if (login_window_delegate_) | 486 if (login_window_delegate_) |
| 491 login_window_delegate_->LoginDisplayHostDestroyed(); | 487 login_window_delegate_->LoginDisplayHostDestroyed(); |
| 492 | 488 |
| 493 chrome::MultiUserWindowManager* window_manager = | 489 chrome::MultiUserWindowManager* window_manager = |
| 494 chrome::MultiUserWindowManager::GetInstance(); | 490 chrome::MultiUserWindowManager::GetInstance(); |
| 495 // MultiUserWindowManager instance might be null if no user is logged in - or | 491 // MultiUserWindowManager instance might be null if no user is logged in - or |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 965 } | 961 } |
| 966 | 962 |
| 967 //////////////////////////////////////////////////////////////////////////////// | 963 //////////////////////////////////////////////////////////////////////////////// |
| 968 // LoginDisplayHostImpl, chromeos::CrasAudioHandler::AudioObserver: | 964 // LoginDisplayHostImpl, chromeos::CrasAudioHandler::AudioObserver: |
| 969 | 965 |
| 970 void LoginDisplayHostImpl::OnActiveOutputNodeChanged() { | 966 void LoginDisplayHostImpl::OnActiveOutputNodeChanged() { |
| 971 TryToPlayStartupSound(); | 967 TryToPlayStartupSound(); |
| 972 } | 968 } |
| 973 | 969 |
| 974 //////////////////////////////////////////////////////////////////////////////// | 970 //////////////////////////////////////////////////////////////////////////////// |
| 975 // LoginDisplayHostImpl, display::DisplayObserver: | |
| 976 | |
| 977 void LoginDisplayHostImpl::OnDisplayAdded(const display::Display& new_display) { | |
| 978 } | |
| 979 | |
| 980 void LoginDisplayHostImpl::OnDisplayRemoved( | |
| 981 const display::Display& old_display) {} | |
| 982 | |
| 983 void LoginDisplayHostImpl::OnDisplayMetricsChanged( | |
| 984 const display::Display& display, | |
| 985 uint32_t changed_metrics) { | |
| 986 display::Display primary_display = | |
| 987 display::Screen::GetScreen()->GetPrimaryDisplay(); | |
| 988 if (display.id() != primary_display.id() || | |
| 989 !(changed_metrics & DISPLAY_METRIC_BOUNDS)) { | |
| 990 return; | |
| 991 } | |
| 992 | |
| 993 if (GetOobeUI()) { | |
| 994 const gfx::Size& size = primary_display.size(); | |
| 995 GetOobeUI()->GetCoreOobeView()->SetClientAreaSize(size.width(), | |
| 996 size.height()); | |
| 997 } | |
| 998 } | |
| 999 | |
| 1000 //////////////////////////////////////////////////////////////////////////////// | |
| 1001 // LoginDisplayHostImpl, views::WidgetRemovalsObserver: | 971 // LoginDisplayHostImpl, views::WidgetRemovalsObserver: |
| 1002 void LoginDisplayHostImpl::OnWillRemoveView(views::Widget* widget, | 972 void LoginDisplayHostImpl::OnWillRemoveView(views::Widget* widget, |
| 1003 views::View* view) { | 973 views::View* view) { |
| 1004 if (view != static_cast<views::View*>(login_view_)) | 974 if (view != static_cast<views::View*>(login_view_)) |
| 1005 return; | 975 return; |
| 1006 login_view_ = nullptr; | 976 login_view_ = nullptr; |
| 1007 widget->RemoveRemovalsObserver(this); | 977 widget->RemoveRemovalsObserver(this); |
| 1008 } | 978 } |
| 1009 | 979 |
| 1010 //////////////////////////////////////////////////////////////////////////////// | 980 //////////////////////////////////////////////////////////////////////////////// |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1389 // Chrome locale. Otherwise it will be lost if Chrome restarts. | 1359 // Chrome locale. Otherwise it will be lost if Chrome restarts. |
| 1390 // Don't need to schedule pref save because setting initial local | 1360 // Don't need to schedule pref save because setting initial local |
| 1391 // will enforce preference saving. | 1361 // will enforce preference saving. |
| 1392 prefs->SetString(prefs::kApplicationLocale, locale); | 1362 prefs->SetString(prefs::kApplicationLocale, locale); |
| 1393 StartupUtils::SetInitialLocale(locale); | 1363 StartupUtils::SetInitialLocale(locale); |
| 1394 | 1364 |
| 1395 TriggerShowLoginWizardFinish(locale, std::move(data)); | 1365 TriggerShowLoginWizardFinish(locale, std::move(data)); |
| 1396 } | 1366 } |
| 1397 | 1367 |
| 1398 } // namespace chromeos | 1368 } // namespace chromeos |
| OLD | NEW |