| 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/wm/lock_state_controller.h" | 7 #include "ash/wm/lock_state_controller.h" |
| 8 #include "ash/wm/lock_state_observer.h" | 8 #include "ash/wm/lock_state_observer.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 WebUIScreenLocker::WebUIScreenLocker(ScreenLocker* screen_locker) | 61 WebUIScreenLocker::WebUIScreenLocker(ScreenLocker* screen_locker) |
| 62 : ScreenLockerDelegate(screen_locker), | 62 : ScreenLockerDelegate(screen_locker), |
| 63 lock_ready_(false), | 63 lock_ready_(false), |
| 64 webui_ready_(false), | 64 webui_ready_(false), |
| 65 network_state_helper_(new login::NetworkStateHelper), | 65 network_state_helper_(new login::NetworkStateHelper), |
| 66 is_observing_keyboard_(false), | 66 is_observing_keyboard_(false), |
| 67 weak_factory_(this) { | 67 weak_factory_(this) { |
| 68 set_should_emit_login_prompt_visible(false); | 68 set_should_emit_login_prompt_visible(false); |
| 69 ash::Shell::GetInstance()->lock_state_controller()->AddObserver(this); | 69 ash::Shell::GetInstance()->lock_state_controller()->AddObserver(this); |
| 70 ash::Shell::GetInstance()->delegate()->AddVirtualKeyboardStateObserver(this); | 70 ash::Shell::GetInstance()->delegate()->AddVirtualKeyboardStateObserver(this); |
| 71 ash::Shell::GetScreen()->AddObserver(this); |
| 71 DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this); | 72 DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this); |
| 72 | 73 |
| 73 if (keyboard::KeyboardController::GetInstance()) { | 74 if (keyboard::KeyboardController::GetInstance()) { |
| 74 keyboard::KeyboardController::GetInstance()->AddObserver(this); | 75 keyboard::KeyboardController::GetInstance()->AddObserver(this); |
| 75 is_observing_keyboard_ = true; | 76 is_observing_keyboard_ = true; |
| 76 } | 77 } |
| 77 } | 78 } |
| 78 | 79 |
| 79 void WebUIScreenLocker::LockScreen() { | 80 void WebUIScreenLocker::LockScreen() { |
| 80 gfx::Rect bounds = | 81 gfx::Rect bounds = |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 | 149 |
| 149 void WebUIScreenLocker::FocusUserPod() { | 150 void WebUIScreenLocker::FocusUserPod() { |
| 150 if (!webui_ready_) | 151 if (!webui_ready_) |
| 151 return; | 152 return; |
| 152 webui_login_->RequestFocus(); | 153 webui_login_->RequestFocus(); |
| 153 GetWebUI()->CallJavascriptFunction("cr.ui.Oobe.forceLockedUserPodFocus"); | 154 GetWebUI()->CallJavascriptFunction("cr.ui.Oobe.forceLockedUserPodFocus"); |
| 154 } | 155 } |
| 155 | 156 |
| 156 WebUIScreenLocker::~WebUIScreenLocker() { | 157 WebUIScreenLocker::~WebUIScreenLocker() { |
| 157 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this); | 158 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this); |
| 159 ash::Shell::GetScreen()->RemoveObserver(this); |
| 158 ash::Shell::GetInstance()-> | 160 ash::Shell::GetInstance()-> |
| 159 lock_state_controller()->RemoveObserver(this); | 161 lock_state_controller()->RemoveObserver(this); |
| 160 | 162 |
| 161 ash::Shell::GetInstance()->delegate()-> | 163 ash::Shell::GetInstance()->delegate()-> |
| 162 RemoveVirtualKeyboardStateObserver(this); | 164 RemoveVirtualKeyboardStateObserver(this); |
| 163 // In case of shutdown, lock_window_ may be deleted before WebUIScreenLocker. | 165 // In case of shutdown, lock_window_ may be deleted before WebUIScreenLocker. |
| 164 if (lock_window_) { | 166 if (lock_window_) { |
| 165 lock_window_->RemoveObserver(this); | 167 lock_window_->RemoveObserver(this); |
| 166 lock_window_->Close(); | 168 lock_window_->Close(); |
| 167 } | 169 } |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 if (GetOobeUI()) { | 363 if (GetOobeUI()) { |
| 362 GetOobeUI()->GetCoreOobeActor()->ShowControlBar(false); | 364 GetOobeUI()->GetCoreOobeActor()->ShowControlBar(false); |
| 363 if (login::LoginScrollIntoViewEnabled()) | 365 if (login::LoginScrollIntoViewEnabled()) |
| 364 GetOobeUI()->GetCoreOobeActor()->SetKeyboardState(true, new_bounds); | 366 GetOobeUI()->GetCoreOobeActor()->SetKeyboardState(true, new_bounds); |
| 365 } | 367 } |
| 366 } | 368 } |
| 367 | 369 |
| 368 keyboard_bounds_ = new_bounds; | 370 keyboard_bounds_ = new_bounds; |
| 369 } | 371 } |
| 370 | 372 |
| 373 //////////////////////////////////////////////////////////////////////////////// |
| 374 // gfx::DisplayObserver implementation: |
| 375 |
| 376 void WebUIScreenLocker::OnDisplayAdded(const gfx::Display& new_display) { |
| 377 } |
| 378 |
| 379 void WebUIScreenLocker::OnDisplayRemoved(const gfx::Display& old_display) { |
| 380 } |
| 381 |
| 382 void WebUIScreenLocker::OnDisplayMetricsChanged(const gfx::Display& display, |
| 383 uint32_t changed_metrics) { |
| 384 gfx::Display primary_display = |
| 385 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); |
| 386 if (display.id() != primary_display.id() || |
| 387 !(changed_metrics & DISPLAY_METRIC_BOUNDS)) { |
| 388 return; |
| 389 } |
| 390 |
| 391 if (GetOobeUI()) { |
| 392 const gfx::Size& size = primary_display.size(); |
| 393 GetOobeUI()->GetCoreOobeActor()->SetClientAreaSize(size.width(), |
| 394 size.height()); |
| 395 } |
| 396 } |
| 397 |
| 371 } // namespace chromeos | 398 } // namespace chromeos |
| OLD | NEW |