| 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/lock/webui_screen_locker.h" | 5 #include "chrome/browser/chromeos/login/lock/webui_screen_locker.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/shell_port.h" |
| 8 #include "ash/system/power/power_event_observer.h" | 9 #include "ash/system/power/power_event_observer.h" |
| 9 #include "ash/wm_shell.h" | |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/feature_list.h" | 11 #include "base/feature_list.h" |
| 12 #include "base/metrics/histogram_macros.h" | 12 #include "base/metrics/histogram_macros.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "chrome/browser/browser_shutdown.h" | 15 #include "chrome/browser/browser_shutdown.h" |
| 16 #include "chrome/browser/chrome_notification_types.h" | 16 #include "chrome/browser/chrome_notification_types.h" |
| 17 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" | 17 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
| 18 #include "chrome/browser/chromeos/login/helper.h" | 18 #include "chrome/browser/chromeos/login/helper.h" |
| 19 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 19 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 118 |
| 119 //////////////////////////////////////////////////////////////////////////////// | 119 //////////////////////////////////////////////////////////////////////////////// |
| 120 // WebUIScreenLocker implementation. | 120 // WebUIScreenLocker implementation. |
| 121 | 121 |
| 122 WebUIScreenLocker::WebUIScreenLocker(ScreenLocker* screen_locker) | 122 WebUIScreenLocker::WebUIScreenLocker(ScreenLocker* screen_locker) |
| 123 : WebUILoginView(BuildConfigSettings()), | 123 : WebUILoginView(BuildConfigSettings()), |
| 124 screen_locker_(screen_locker), | 124 screen_locker_(screen_locker), |
| 125 network_state_helper_(new login::NetworkStateHelper), | 125 network_state_helper_(new login::NetworkStateHelper), |
| 126 weak_factory_(this) { | 126 weak_factory_(this) { |
| 127 set_should_emit_login_prompt_visible(false); | 127 set_should_emit_login_prompt_visible(false); |
| 128 ash::WmShell::Get()->AddLockStateObserver(this); | 128 ash::ShellPort::Get()->AddLockStateObserver(this); |
| 129 ash::Shell::Get()->AddShellObserver(this); | 129 ash::Shell::Get()->AddShellObserver(this); |
| 130 display::Screen::GetScreen()->AddObserver(this); | 130 display::Screen::GetScreen()->AddObserver(this); |
| 131 DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this); | 131 DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this); |
| 132 | 132 |
| 133 if (keyboard::KeyboardController::GetInstance()) { | 133 if (keyboard::KeyboardController::GetInstance()) { |
| 134 keyboard::KeyboardController::GetInstance()->AddObserver(this); | 134 keyboard::KeyboardController::GetInstance()->AddObserver(this); |
| 135 is_observing_keyboard_ = true; | 135 is_observing_keyboard_ = true; |
| 136 } | 136 } |
| 137 } | 137 } |
| 138 | 138 |
| 139 WebUIScreenLocker::~WebUIScreenLocker() { | 139 WebUIScreenLocker::~WebUIScreenLocker() { |
| 140 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this); | 140 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this); |
| 141 display::Screen::GetScreen()->RemoveObserver(this); | 141 display::Screen::GetScreen()->RemoveObserver(this); |
| 142 ash::WmShell::Get()->RemoveLockStateObserver(this); | 142 ash::ShellPort::Get()->RemoveLockStateObserver(this); |
| 143 ash::Shell::Get()->RemoveShellObserver(this); | 143 ash::Shell::Get()->RemoveShellObserver(this); |
| 144 // In case of shutdown, lock_window_ may be deleted before WebUIScreenLocker. | 144 // In case of shutdown, lock_window_ may be deleted before WebUIScreenLocker. |
| 145 if (lock_window_) { | 145 if (lock_window_) { |
| 146 lock_window_->RemoveObserver(this); | 146 lock_window_->RemoveObserver(this); |
| 147 lock_window_->Close(); | 147 lock_window_->Close(); |
| 148 } | 148 } |
| 149 // If LockScreen() was called, we need to clear the signin screen handler | 149 // If LockScreen() was called, we need to clear the signin screen handler |
| 150 // delegate set in ShowSigninScreen so that it no longer points to us. | 150 // delegate set in ShowSigninScreen so that it no longer points to us. |
| 151 if (login_display_.get() && GetOobeUI()) | 151 if (login_display_.get() && GetOobeUI()) |
| 152 GetOobeUI()->ResetSigninScreenHandlerDelegate(); | 152 GetOobeUI()->ResetSigninScreenHandlerDelegate(); |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 } | 471 } |
| 472 | 472 |
| 473 if (GetOobeUI()) { | 473 if (GetOobeUI()) { |
| 474 const gfx::Size& size = primary_display.size(); | 474 const gfx::Size& size = primary_display.size(); |
| 475 GetOobeUI()->GetCoreOobeView()->SetClientAreaSize(size.width(), | 475 GetOobeUI()->GetCoreOobeView()->SetClientAreaSize(size.width(), |
| 476 size.height()); | 476 size.height()); |
| 477 } | 477 } |
| 478 } | 478 } |
| 479 | 479 |
| 480 } // namespace chromeos | 480 } // namespace chromeos |
| OLD | NEW |