OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/webui_screen_locker.h" | 5 #include "chrome/browser/chromeos/login/webui_screen_locker.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/wm/session_state_controller.h" | 8 #include "ash/wm/session_state_controller.h" |
9 #include "ash/wm/session_state_observer.h" | 9 #include "ash/wm/session_state_observer.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
13 #include "base/values.h" | 13 #include "base/values.h" |
14 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" | 14 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
15 #include "chrome/browser/chromeos/login/helper.h" | 15 #include "chrome/browser/chromeos/login/helper.h" |
16 #include "chrome/browser/chromeos/login/screen_locker.h" | 16 #include "chrome/browser/chromeos/login/screen_locker.h" |
17 #include "chrome/browser/chromeos/login/user_manager.h" | 17 #include "chrome/browser/chromeos/login/user_manager.h" |
18 #include "chrome/browser/chromeos/login/webui_login_display.h" | 18 #include "chrome/browser/chromeos/login/webui_login_display.h" |
19 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 19 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
20 #include "chrome/common/chrome_notification_types.h" | 20 #include "chrome/common/chrome_notification_types.h" |
21 #include "chrome/common/url_constants.h" | 21 #include "chrome/common/url_constants.h" |
22 #include "chromeos/dbus/dbus_thread_manager.h" | 22 #include "chromeos/dbus/dbus_thread_manager.h" |
23 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
24 #include "content/public/browser/notification_service.h" | 24 #include "content/public/browser/notification_service.h" |
25 #include "content/public/browser/notification_types.h" | 25 #include "content/public/browser/notification_types.h" |
26 #include "content/public/browser/render_widget_host_view.h" | 26 #include "content/public/browser/render_widget_host_view.h" |
27 #include "content/public/browser/web_ui.h" | 27 #include "content/public/browser/web_ui.h" |
| 28 #include "ui/aura/client/capture_client.h" |
28 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
29 #include "ui/base/x/x11_util.h" | 30 #include "ui/base/x/x11_util.h" |
30 #include "ui/gfx/screen.h" | 31 #include "ui/gfx/screen.h" |
31 #include "ui/views/controls/webview/webview.h" | 32 #include "ui/views/controls/webview/webview.h" |
32 | 33 |
33 namespace { | 34 namespace { |
34 | 35 |
35 // URL which corresponds to the login WebUI. | 36 // URL which corresponds to the login WebUI. |
36 const char kLoginURL[] = "chrome://oobe/login"; | 37 const char kLoginURL[] = "chrome://oobe/login"; |
37 | 38 |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 lock_ready_ = true; | 267 lock_ready_ = true; |
267 if (webui_ready_) | 268 if (webui_ready_) |
268 ScreenLockReady(); | 269 ScreenLockReady(); |
269 } | 270 } |
270 | 271 |
271 //////////////////////////////////////////////////////////////////////////////// | 272 //////////////////////////////////////////////////////////////////////////////// |
272 // SessionStateObserver override. | 273 // SessionStateObserver override. |
273 | 274 |
274 void WebUIScreenLocker::OnSessionStateEvent( | 275 void WebUIScreenLocker::OnSessionStateEvent( |
275 ash::SessionStateObserver::EventType event) { | 276 ash::SessionStateObserver::EventType event) { |
276 if (event == ash::SessionStateObserver::EVENT_LOCK_ANIMATION_FINISHED) | 277 if (event == ash::SessionStateObserver::EVENT_LOCK_ANIMATION_FINISHED) { |
| 278 // Release capture if any. |
| 279 aura::client::GetCaptureClient(GetNativeWindow()->GetRootWindow())-> |
| 280 SetCapture(NULL); |
277 GetWebUI()->CallJavascriptFunction("cr.ui.Oobe.animateOnceFullyDisplayed"); | 281 GetWebUI()->CallJavascriptFunction("cr.ui.Oobe.animateOnceFullyDisplayed"); |
| 282 } |
278 } | 283 } |
279 | 284 |
280 //////////////////////////////////////////////////////////////////////////////// | 285 //////////////////////////////////////////////////////////////////////////////// |
281 // WidgetObserver override. | 286 // WidgetObserver override. |
282 | 287 |
283 void WebUIScreenLocker::OnWidgetDestroying(views::Widget* widget) { | 288 void WebUIScreenLocker::OnWidgetDestroying(views::Widget* widget) { |
284 lock_window_->RemoveObserver(this); | 289 lock_window_->RemoveObserver(this); |
285 lock_window_ = NULL; | 290 lock_window_ = NULL; |
286 } | 291 } |
287 | 292 |
288 //////////////////////////////////////////////////////////////////////////////// | 293 //////////////////////////////////////////////////////////////////////////////// |
289 // PowerManagerClient::Observer overrides. | 294 // PowerManagerClient::Observer overrides. |
290 | 295 |
291 void WebUIScreenLocker::LidEventReceived(bool open, | 296 void WebUIScreenLocker::LidEventReceived(bool open, |
292 const base::TimeTicks& time) { | 297 const base::TimeTicks& time) { |
293 content::BrowserThread::PostTask( | 298 content::BrowserThread::PostTask( |
294 content::BrowserThread::UI, | 299 content::BrowserThread::UI, |
295 FROM_HERE, | 300 FROM_HERE, |
296 base::Bind(&WebUIScreenLocker::FocusUserPod, weak_factory_.GetWeakPtr())); | 301 base::Bind(&WebUIScreenLocker::FocusUserPod, weak_factory_.GetWeakPtr())); |
297 } | 302 } |
298 | 303 |
299 void WebUIScreenLocker::SystemResumed(const base::TimeDelta& sleep_duration) { | 304 void WebUIScreenLocker::SystemResumed(const base::TimeDelta& sleep_duration) { |
300 content::BrowserThread::PostTask( | 305 content::BrowserThread::PostTask( |
301 content::BrowserThread::UI, | 306 content::BrowserThread::UI, |
302 FROM_HERE, | 307 FROM_HERE, |
303 base::Bind(&WebUIScreenLocker::FocusUserPod, weak_factory_.GetWeakPtr())); | 308 base::Bind(&WebUIScreenLocker::FocusUserPod, weak_factory_.GetWeakPtr())); |
304 } | 309 } |
305 | 310 |
306 } // namespace chromeos | 311 } // namespace chromeos |
OLD | NEW |