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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 124 |
125 void WebUIScreenLocker::ShowErrorMessage( | 125 void WebUIScreenLocker::ShowErrorMessage( |
126 int error_msg_id, | 126 int error_msg_id, |
127 HelpAppLauncher::HelpTopic help_topic_id) { | 127 HelpAppLauncher::HelpTopic help_topic_id) { |
128 login_display_->ShowError(error_msg_id, | 128 login_display_->ShowError(error_msg_id, |
129 0 /* login_attempts */, | 129 0 /* login_attempts */, |
130 help_topic_id); | 130 help_topic_id); |
131 } | 131 } |
132 | 132 |
133 void WebUIScreenLocker::AnimateAuthenticationSuccess() { | 133 void WebUIScreenLocker::AnimateAuthenticationSuccess() { |
134 GetWebUI()->CallJavascriptFunction("cr.ui.Oobe.animateAuthenticationSuccess"); | 134 GetWebUI()->CallJavascriptFunctionUnsafe( |
| 135 "cr.ui.Oobe.animateAuthenticationSuccess"); |
135 } | 136 } |
136 | 137 |
137 void WebUIScreenLocker::ClearErrors() { | 138 void WebUIScreenLocker::ClearErrors() { |
138 GetWebUI()->CallJavascriptFunction("cr.ui.Oobe.clearErrors"); | 139 GetWebUI()->CallJavascriptFunctionUnsafe("cr.ui.Oobe.clearErrors"); |
139 } | 140 } |
140 | 141 |
141 gfx::NativeWindow WebUIScreenLocker::GetNativeWindow() const { | 142 gfx::NativeWindow WebUIScreenLocker::GetNativeWindow() const { |
142 return lock_window_->GetNativeWindow(); | 143 return lock_window_->GetNativeWindow(); |
143 } | 144 } |
144 | 145 |
145 content::WebUI* WebUIScreenLocker::GetAssociatedWebUI() { | 146 content::WebUI* WebUIScreenLocker::GetAssociatedWebUI() { |
146 return GetWebUI(); | 147 return GetWebUI(); |
147 } | 148 } |
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()->CallJavascriptFunctionUnsafe( |
| 155 "cr.ui.Oobe.forceLockedUserPodFocus"); |
154 } | 156 } |
155 | 157 |
156 void WebUIScreenLocker::ResetAndFocusUserPod() { | 158 void WebUIScreenLocker::ResetAndFocusUserPod() { |
157 if (!webui_ready_) | 159 if (!webui_ready_) |
158 return; | 160 return; |
159 GetWebUI()->CallJavascriptFunction("cr.ui.Oobe.clearUserPodPassword"); | 161 GetWebUI()->CallJavascriptFunctionUnsafe("cr.ui.Oobe.clearUserPodPassword"); |
160 FocusUserPod(); | 162 FocusUserPod(); |
161 } | 163 } |
162 | 164 |
163 WebUIScreenLocker::~WebUIScreenLocker() { | 165 WebUIScreenLocker::~WebUIScreenLocker() { |
164 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this); | 166 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this); |
165 display::Screen::GetScreen()->RemoveObserver(this); | 167 display::Screen::GetScreen()->RemoveObserver(this); |
166 ash::Shell::GetInstance()-> | 168 ash::Shell::GetInstance()-> |
167 lock_state_controller()->RemoveObserver(this); | 169 lock_state_controller()->RemoveObserver(this); |
168 | 170 |
169 ash::Shell::GetInstance()->delegate()-> | 171 ash::Shell::GetInstance()->delegate()-> |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 | 298 |
297 //////////////////////////////////////////////////////////////////////////////// | 299 //////////////////////////////////////////////////////////////////////////////// |
298 // SessionLockStateObserver: | 300 // SessionLockStateObserver: |
299 | 301 |
300 void WebUIScreenLocker::OnLockStateEvent( | 302 void WebUIScreenLocker::OnLockStateEvent( |
301 ash::LockStateObserver::EventType event) { | 303 ash::LockStateObserver::EventType event) { |
302 if (event == ash::LockStateObserver::EVENT_LOCK_ANIMATION_FINISHED) { | 304 if (event == ash::LockStateObserver::EVENT_LOCK_ANIMATION_FINISHED) { |
303 // Release capture if any. | 305 // Release capture if any. |
304 aura::client::GetCaptureClient(GetNativeWindow()->GetRootWindow())-> | 306 aura::client::GetCaptureClient(GetNativeWindow()->GetRootWindow())-> |
305 SetCapture(NULL); | 307 SetCapture(NULL); |
306 GetWebUI()->CallJavascriptFunction("cr.ui.Oobe.animateOnceFullyDisplayed"); | 308 GetWebUI()->CallJavascriptFunctionUnsafe( |
| 309 "cr.ui.Oobe.animateOnceFullyDisplayed"); |
307 } | 310 } |
308 } | 311 } |
309 | 312 |
310 //////////////////////////////////////////////////////////////////////////////// | 313 //////////////////////////////////////////////////////////////////////////////// |
311 // WidgetObserver: | 314 // WidgetObserver: |
312 | 315 |
313 void WebUIScreenLocker::OnWidgetDestroying(views::Widget* widget) { | 316 void WebUIScreenLocker::OnWidgetDestroying(views::Widget* widget) { |
314 lock_window_->RemoveObserver(this); | 317 lock_window_->RemoveObserver(this); |
315 lock_window_ = NULL; | 318 lock_window_ = NULL; |
316 } | 319 } |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 } | 424 } |
422 | 425 |
423 if (GetOobeUI()) { | 426 if (GetOobeUI()) { |
424 const gfx::Size& size = primary_display.size(); | 427 const gfx::Size& size = primary_display.size(); |
425 GetOobeUI()->GetCoreOobeActor()->SetClientAreaSize(size.width(), | 428 GetOobeUI()->GetCoreOobeActor()->SetClientAreaSize(size.width(), |
426 size.height()); | 429 size.height()); |
427 } | 430 } |
428 } | 431 } |
429 | 432 |
430 } // namespace chromeos | 433 } // namespace chromeos |
OLD | NEW |