| 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/audio/sounds.h" | 10 #include "ash/audio/sounds.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 #include "content/public/browser/web_contents.h" | 83 #include "content/public/browser/web_contents.h" |
| 84 #include "content/public/browser/web_ui.h" | 84 #include "content/public/browser/web_ui.h" |
| 85 #include "media/audio/sounds/sounds_manager.h" | 85 #include "media/audio/sounds/sounds_manager.h" |
| 86 #include "ui/aura/window.h" | 86 #include "ui/aura/window.h" |
| 87 #include "ui/base/ime/chromeos/extension_ime_util.h" | 87 #include "ui/base/ime/chromeos/extension_ime_util.h" |
| 88 #include "ui/base/ime/chromeos/input_method_manager.h" | 88 #include "ui/base/ime/chromeos/input_method_manager.h" |
| 89 #include "ui/base/resource/resource_bundle.h" | 89 #include "ui/base/resource/resource_bundle.h" |
| 90 #include "ui/compositor/layer.h" | 90 #include "ui/compositor/layer.h" |
| 91 #include "ui/compositor/layer_animation_observer.h" | 91 #include "ui/compositor/layer_animation_observer.h" |
| 92 #include "ui/compositor/scoped_layer_animation_settings.h" | 92 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 93 #include "ui/display/display.h" |
| 94 #include "ui/display/screen.h" |
| 93 #include "ui/events/event_utils.h" | 95 #include "ui/events/event_utils.h" |
| 94 #include "ui/gfx/display.h" | |
| 95 #include "ui/gfx/geometry/rect.h" | 96 #include "ui/gfx/geometry/rect.h" |
| 96 #include "ui/gfx/geometry/size.h" | 97 #include "ui/gfx/geometry/size.h" |
| 97 #include "ui/gfx/screen.h" | |
| 98 #include "ui/gfx/transform.h" | 98 #include "ui/gfx/transform.h" |
| 99 #include "ui/keyboard/keyboard_controller.h" | 99 #include "ui/keyboard/keyboard_controller.h" |
| 100 #include "ui/keyboard/keyboard_util.h" | 100 #include "ui/keyboard/keyboard_util.h" |
| 101 #include "ui/views/focus/focus_manager.h" | 101 #include "ui/views/focus/focus_manager.h" |
| 102 #include "ui/views/widget/widget.h" | 102 #include "ui/views/widget/widget.h" |
| 103 #include "ui/views/widget/widget_delegate.h" | 103 #include "ui/views/widget/widget_delegate.h" |
| 104 #include "url/gurl.h" | 104 #include "url/gurl.h" |
| 105 | 105 |
| 106 namespace { | 106 namespace { |
| 107 | 107 |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 pointer_factory_(this), | 278 pointer_factory_(this), |
| 279 animation_weak_ptr_factory_(this) { | 279 animation_weak_ptr_factory_(this) { |
| 280 DBusThreadManager::Get()->GetSessionManagerClient()->AddObserver(this); | 280 DBusThreadManager::Get()->GetSessionManagerClient()->AddObserver(this); |
| 281 CrasAudioHandler::Get()->AddAudioObserver(this); | 281 CrasAudioHandler::Get()->AddAudioObserver(this); |
| 282 if (keyboard::KeyboardController::GetInstance()) { | 282 if (keyboard::KeyboardController::GetInstance()) { |
| 283 keyboard::KeyboardController::GetInstance()->AddObserver(this); | 283 keyboard::KeyboardController::GetInstance()->AddObserver(this); |
| 284 is_observing_keyboard_ = true; | 284 is_observing_keyboard_ = true; |
| 285 } | 285 } |
| 286 | 286 |
| 287 ash::Shell::GetInstance()->delegate()->AddVirtualKeyboardStateObserver(this); | 287 ash::Shell::GetInstance()->delegate()->AddVirtualKeyboardStateObserver(this); |
| 288 gfx::Screen::GetScreen()->AddObserver(this); | 288 display::Screen::GetScreen()->AddObserver(this); |
| 289 | 289 |
| 290 // We need to listen to CLOSE_ALL_BROWSERS_REQUEST but not APP_TERMINATING | 290 // We need to listen to CLOSE_ALL_BROWSERS_REQUEST but not APP_TERMINATING |
| 291 // because/ APP_TERMINATING will never be fired as long as this keeps | 291 // because/ APP_TERMINATING will never be fired as long as this keeps |
| 292 // ref-count. CLOSE_ALL_BROWSERS_REQUEST is safe here because there will be no | 292 // ref-count. CLOSE_ALL_BROWSERS_REQUEST is safe here because there will be no |
| 293 // browser instance that will block the shutdown. | 293 // browser instance that will block the shutdown. |
| 294 registrar_.Add(this, | 294 registrar_.Add(this, |
| 295 chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST, | 295 chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST, |
| 296 content::NotificationService::AllSources()); | 296 content::NotificationService::AllSources()); |
| 297 | 297 |
| 298 // NOTIFICATION_BROWSER_OPENED is issued after browser is created, but | 298 // NOTIFICATION_BROWSER_OPENED is issued after browser is created, but |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 LoginDisplayHostImpl::~LoginDisplayHostImpl() { | 384 LoginDisplayHostImpl::~LoginDisplayHostImpl() { |
| 385 DBusThreadManager::Get()->GetSessionManagerClient()->RemoveObserver(this); | 385 DBusThreadManager::Get()->GetSessionManagerClient()->RemoveObserver(this); |
| 386 CrasAudioHandler::Get()->RemoveAudioObserver(this); | 386 CrasAudioHandler::Get()->RemoveAudioObserver(this); |
| 387 if (keyboard::KeyboardController::GetInstance() && is_observing_keyboard_) { | 387 if (keyboard::KeyboardController::GetInstance() && is_observing_keyboard_) { |
| 388 keyboard::KeyboardController::GetInstance()->RemoveObserver(this); | 388 keyboard::KeyboardController::GetInstance()->RemoveObserver(this); |
| 389 is_observing_keyboard_ = false; | 389 is_observing_keyboard_ = false; |
| 390 } | 390 } |
| 391 | 391 |
| 392 ash::Shell::GetInstance()->delegate()-> | 392 ash::Shell::GetInstance()->delegate()-> |
| 393 RemoveVirtualKeyboardStateObserver(this); | 393 RemoveVirtualKeyboardStateObserver(this); |
| 394 gfx::Screen::GetScreen()->RemoveObserver(this); | 394 display::Screen::GetScreen()->RemoveObserver(this); |
| 395 | 395 |
| 396 if (login_view_ && login_window_) | 396 if (login_view_ && login_window_) |
| 397 login_window_->RemoveRemovalsObserver(this); | 397 login_window_->RemoveRemovalsObserver(this); |
| 398 | 398 |
| 399 chrome::MultiUserWindowManager* window_manager = | 399 chrome::MultiUserWindowManager* window_manager = |
| 400 chrome::MultiUserWindowManager::GetInstance(); | 400 chrome::MultiUserWindowManager::GetInstance(); |
| 401 // MultiUserWindowManager instance might be null if no user is logged in - or | 401 // MultiUserWindowManager instance might be null if no user is logged in - or |
| 402 // in a unit test. | 402 // in a unit test. |
| 403 if (window_manager) | 403 if (window_manager) |
| 404 window_manager->RemoveObserver(this); | 404 window_manager->RemoveObserver(this); |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 if (GetOobeUI()) | 900 if (GetOobeUI()) |
| 901 GetOobeUI()->GetCoreOobeActor()->ShowControlBar(true); | 901 GetOobeUI()->GetCoreOobeActor()->ShowControlBar(true); |
| 902 } else if (!new_bounds.IsEmpty()) { | 902 } else if (!new_bounds.IsEmpty()) { |
| 903 // Keyboard has been shown. | 903 // Keyboard has been shown. |
| 904 if (GetOobeUI()) | 904 if (GetOobeUI()) |
| 905 GetOobeUI()->GetCoreOobeActor()->ShowControlBar(false); | 905 GetOobeUI()->GetCoreOobeActor()->ShowControlBar(false); |
| 906 } | 906 } |
| 907 } | 907 } |
| 908 | 908 |
| 909 //////////////////////////////////////////////////////////////////////////////// | 909 //////////////////////////////////////////////////////////////////////////////// |
| 910 // LoginDisplayHostImpl, gfx::DisplayObserver implementation: | 910 // LoginDisplayHostImpl, display::DisplayObserver implementation: |
| 911 | 911 |
| 912 void LoginDisplayHostImpl::OnDisplayAdded(const gfx::Display& new_display) { | 912 void LoginDisplayHostImpl::OnDisplayAdded(const display::Display& new_display) { |
| 913 } | 913 } |
| 914 | 914 |
| 915 void LoginDisplayHostImpl::OnDisplayRemoved(const gfx::Display& old_display) { | 915 void LoginDisplayHostImpl::OnDisplayRemoved( |
| 916 } | 916 const display::Display& old_display) {} |
| 917 | 917 |
| 918 void LoginDisplayHostImpl::OnDisplayMetricsChanged(const gfx::Display& display, | 918 void LoginDisplayHostImpl::OnDisplayMetricsChanged( |
| 919 uint32_t changed_metrics) { | 919 const display::Display& display, |
| 920 gfx::Display primary_display = gfx::Screen::GetScreen()->GetPrimaryDisplay(); | 920 uint32_t changed_metrics) { |
| 921 display::Display primary_display = |
| 922 display::Screen::GetScreen()->GetPrimaryDisplay(); |
| 921 if (display.id() != primary_display.id() || | 923 if (display.id() != primary_display.id() || |
| 922 !(changed_metrics & DISPLAY_METRIC_BOUNDS)) { | 924 !(changed_metrics & DISPLAY_METRIC_BOUNDS)) { |
| 923 return; | 925 return; |
| 924 } | 926 } |
| 925 | 927 |
| 926 if (GetOobeUI()) { | 928 if (GetOobeUI()) { |
| 927 const gfx::Size& size = primary_display.size(); | 929 const gfx::Size& size = primary_display.size(); |
| 928 GetOobeUI()->GetCoreOobeActor()->SetClientAreaSize(size.width(), | 930 GetOobeUI()->GetCoreOobeActor()->SetClientAreaSize(size.width(), |
| 929 size.height()); | 931 size.height()); |
| 930 } | 932 } |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1305 | 1307 |
| 1306 locale_util::SwitchLanguageCallback callback( | 1308 locale_util::SwitchLanguageCallback callback( |
| 1307 base::Bind(&OnLanguageSwitchedCallback, base::Passed(std::move(data)))); | 1309 base::Bind(&OnLanguageSwitchedCallback, base::Passed(std::move(data)))); |
| 1308 | 1310 |
| 1309 // Load locale keyboards here. Hardware layout would be automatically enabled. | 1311 // Load locale keyboards here. Hardware layout would be automatically enabled. |
| 1310 locale_util::SwitchLanguage(locale, true, true /* login_layouts_only */, | 1312 locale_util::SwitchLanguage(locale, true, true /* login_layouts_only */, |
| 1311 callback, ProfileManager::GetActiveUserProfile()); | 1313 callback, ProfileManager::GetActiveUserProfile()); |
| 1312 } | 1314 } |
| 1313 | 1315 |
| 1314 } // namespace chromeos | 1316 } // namespace chromeos |
| OLD | NEW |