| 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/common/wm_shell.h" | 7 #include "ash/common/wm_shell.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/system/chromeos/power/power_event_observer.h" | 9 #include "ash/system/chromeos/power/power_event_observer.h" |
| 10 #include "ash/wm/lock_state_controller.h" | |
| 11 #include "ash/wm/lock_state_observer.h" | |
| 12 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 13 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 15 #include "base/values.h" | 13 #include "base/values.h" |
| 16 #include "chrome/browser/browser_shutdown.h" | 14 #include "chrome/browser/browser_shutdown.h" |
| 17 #include "chrome/browser/chrome_notification_types.h" | 15 #include "chrome/browser/chrome_notification_types.h" |
| 18 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" | 16 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
| 19 #include "chrome/browser/chromeos/login/helper.h" | 17 #include "chrome/browser/chromeos/login/helper.h" |
| 20 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 18 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
| 21 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" | 19 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 namespace chromeos { | 58 namespace chromeos { |
| 61 | 59 |
| 62 //////////////////////////////////////////////////////////////////////////////// | 60 //////////////////////////////////////////////////////////////////////////////// |
| 63 // WebUIScreenLocker implementation. | 61 // WebUIScreenLocker implementation. |
| 64 | 62 |
| 65 WebUIScreenLocker::WebUIScreenLocker(ScreenLocker* screen_locker) | 63 WebUIScreenLocker::WebUIScreenLocker(ScreenLocker* screen_locker) |
| 66 : ScreenLockerDelegate(screen_locker), | 64 : ScreenLockerDelegate(screen_locker), |
| 67 network_state_helper_(new login::NetworkStateHelper), | 65 network_state_helper_(new login::NetworkStateHelper), |
| 68 weak_factory_(this) { | 66 weak_factory_(this) { |
| 69 set_should_emit_login_prompt_visible(false); | 67 set_should_emit_login_prompt_visible(false); |
| 70 ash::Shell::GetInstance()->lock_state_controller()->AddObserver(this); | 68 ash::WmShell::Get()->AddLockStateObserver(this); |
| 71 ash::WmShell::Get()->AddShellObserver(this); | 69 ash::WmShell::Get()->AddShellObserver(this); |
| 72 display::Screen::GetScreen()->AddObserver(this); | 70 display::Screen::GetScreen()->AddObserver(this); |
| 73 DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this); | 71 DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this); |
| 74 | 72 |
| 75 if (keyboard::KeyboardController::GetInstance()) { | 73 if (keyboard::KeyboardController::GetInstance()) { |
| 76 keyboard::KeyboardController::GetInstance()->AddObserver(this); | 74 keyboard::KeyboardController::GetInstance()->AddObserver(this); |
| 77 is_observing_keyboard_ = true; | 75 is_observing_keyboard_ = true; |
| 78 } | 76 } |
| 79 } | 77 } |
| 80 | 78 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 void WebUIScreenLocker::ResetAndFocusUserPod() { | 157 void WebUIScreenLocker::ResetAndFocusUserPod() { |
| 160 if (!webui_ready_) | 158 if (!webui_ready_) |
| 161 return; | 159 return; |
| 162 GetWebUI()->CallJavascriptFunctionUnsafe("cr.ui.Oobe.clearUserPodPassword"); | 160 GetWebUI()->CallJavascriptFunctionUnsafe("cr.ui.Oobe.clearUserPodPassword"); |
| 163 FocusUserPod(); | 161 FocusUserPod(); |
| 164 } | 162 } |
| 165 | 163 |
| 166 WebUIScreenLocker::~WebUIScreenLocker() { | 164 WebUIScreenLocker::~WebUIScreenLocker() { |
| 167 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this); | 165 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this); |
| 168 display::Screen::GetScreen()->RemoveObserver(this); | 166 display::Screen::GetScreen()->RemoveObserver(this); |
| 169 ash::Shell::GetInstance()->lock_state_controller()->RemoveObserver(this); | 167 ash::WmShell::Get()->RemoveLockStateObserver(this); |
| 170 | |
| 171 ash::WmShell::Get()->RemoveShellObserver(this); | 168 ash::WmShell::Get()->RemoveShellObserver(this); |
| 172 // In case of shutdown, lock_window_ may be deleted before WebUIScreenLocker. | 169 // In case of shutdown, lock_window_ may be deleted before WebUIScreenLocker. |
| 173 if (lock_window_) { | 170 if (lock_window_) { |
| 174 lock_window_->RemoveObserver(this); | 171 lock_window_->RemoveObserver(this); |
| 175 lock_window_->Close(); | 172 lock_window_->Close(); |
| 176 } | 173 } |
| 177 // If LockScreen() was called, we need to clear the signin screen handler | 174 // If LockScreen() was called, we need to clear the signin screen handler |
| 178 // delegate set in ShowSigninScreen so that it no longer points to us. | 175 // delegate set in ShowSigninScreen so that it no longer points to us. |
| 179 if (login_display_.get()) { | 176 if (login_display_.get()) { |
| 180 static_cast<OobeUI*>(GetWebUI()->GetController())-> | 177 static_cast<OobeUI*>(GetWebUI()->GetController())-> |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 } | 399 } |
| 403 | 400 |
| 404 if (GetOobeUI()) { | 401 if (GetOobeUI()) { |
| 405 const gfx::Size& size = primary_display.size(); | 402 const gfx::Size& size = primary_display.size(); |
| 406 GetOobeUI()->GetCoreOobeActor()->SetClientAreaSize(size.width(), | 403 GetOobeUI()->GetCoreOobeActor()->SetClientAreaSize(size.width(), |
| 407 size.height()); | 404 size.height()); |
| 408 } | 405 } |
| 409 } | 406 } |
| 410 | 407 |
| 411 } // namespace chromeos | 408 } // namespace chromeos |
| OLD | NEW |