| 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/system/chromeos/power/power_event_observer.h" | 8 #include "ash/system/chromeos/power/power_event_observer.h" |
| 9 #include "ash/wm/lock_state_controller.h" | 9 #include "ash/wm/lock_state_controller.h" |
| 10 #include "ash/wm/lock_state_observer.h" | 10 #include "ash/wm/lock_state_observer.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 WebUIScreenLocker::WebUIScreenLocker(ScreenLocker* screen_locker) | 63 WebUIScreenLocker::WebUIScreenLocker(ScreenLocker* screen_locker) |
| 64 : ScreenLockerDelegate(screen_locker), | 64 : ScreenLockerDelegate(screen_locker), |
| 65 lock_ready_(false), | 65 lock_ready_(false), |
| 66 webui_ready_(false), | 66 webui_ready_(false), |
| 67 network_state_helper_(new login::NetworkStateHelper), | 67 network_state_helper_(new login::NetworkStateHelper), |
| 68 is_observing_keyboard_(false), | 68 is_observing_keyboard_(false), |
| 69 weak_factory_(this) { | 69 weak_factory_(this) { |
| 70 set_should_emit_login_prompt_visible(false); | 70 set_should_emit_login_prompt_visible(false); |
| 71 ash::Shell::GetInstance()->lock_state_controller()->AddObserver(this); | 71 ash::Shell::GetInstance()->lock_state_controller()->AddObserver(this); |
| 72 ash::Shell::GetInstance()->delegate()->AddVirtualKeyboardStateObserver(this); | 72 ash::Shell::GetInstance()->delegate()->AddVirtualKeyboardStateObserver(this); |
| 73 ash::Shell::GetScreen()->AddObserver(this); | 73 gfx::Screen::GetScreen()->AddObserver(this); |
| 74 DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this); | 74 DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this); |
| 75 | 75 |
| 76 if (keyboard::KeyboardController::GetInstance()) { | 76 if (keyboard::KeyboardController::GetInstance()) { |
| 77 keyboard::KeyboardController::GetInstance()->AddObserver(this); | 77 keyboard::KeyboardController::GetInstance()->AddObserver(this); |
| 78 is_observing_keyboard_ = true; | 78 is_observing_keyboard_ = true; |
| 79 } | 79 } |
| 80 } | 80 } |
| 81 | 81 |
| 82 void WebUIScreenLocker::LockScreen() { | 82 void WebUIScreenLocker::LockScreen() { |
| 83 gfx::Rect bounds = gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds(); | 83 gfx::Rect bounds = gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds(); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 | 157 |
| 158 void WebUIScreenLocker::ResetAndFocusUserPod() { | 158 void WebUIScreenLocker::ResetAndFocusUserPod() { |
| 159 if (!webui_ready_) | 159 if (!webui_ready_) |
| 160 return; | 160 return; |
| 161 GetWebUI()->CallJavascriptFunction("cr.ui.Oobe.clearUserPodPassword"); | 161 GetWebUI()->CallJavascriptFunction("cr.ui.Oobe.clearUserPodPassword"); |
| 162 FocusUserPod(); | 162 FocusUserPod(); |
| 163 } | 163 } |
| 164 | 164 |
| 165 WebUIScreenLocker::~WebUIScreenLocker() { | 165 WebUIScreenLocker::~WebUIScreenLocker() { |
| 166 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this); | 166 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this); |
| 167 ash::Shell::GetScreen()->RemoveObserver(this); | 167 gfx::Screen::GetScreen()->RemoveObserver(this); |
| 168 ash::Shell::GetInstance()-> | 168 ash::Shell::GetInstance()-> |
| 169 lock_state_controller()->RemoveObserver(this); | 169 lock_state_controller()->RemoveObserver(this); |
| 170 | 170 |
| 171 ash::Shell::GetInstance()->delegate()-> | 171 ash::Shell::GetInstance()->delegate()-> |
| 172 RemoveVirtualKeyboardStateObserver(this); | 172 RemoveVirtualKeyboardStateObserver(this); |
| 173 // In case of shutdown, lock_window_ may be deleted before WebUIScreenLocker. | 173 // In case of shutdown, lock_window_ may be deleted before WebUIScreenLocker. |
| 174 if (lock_window_) { | 174 if (lock_window_) { |
| 175 lock_window_->RemoveObserver(this); | 175 lock_window_->RemoveObserver(this); |
| 176 lock_window_->Close(); | 176 lock_window_->Close(); |
| 177 } | 177 } |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 } | 402 } |
| 403 | 403 |
| 404 if (GetOobeUI()) { | 404 if (GetOobeUI()) { |
| 405 const gfx::Size& size = primary_display.size(); | 405 const gfx::Size& size = primary_display.size(); |
| 406 GetOobeUI()->GetCoreOobeActor()->SetClientAreaSize(size.width(), | 406 GetOobeUI()->GetCoreOobeActor()->SetClientAreaSize(size.width(), |
| 407 size.height()); | 407 size.height()); |
| 408 } | 408 } |
| 409 } | 409 } |
| 410 | 410 |
| 411 } // namespace chromeos | 411 } // namespace chromeos |
| OLD | NEW |