| 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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 lock_ready_ = true; | 269 lock_ready_ = true; |
| 269 if (webui_ready_) | 270 if (webui_ready_) |
| 270 ScreenLockReady(); | 271 ScreenLockReady(); |
| 271 } | 272 } |
| 272 | 273 |
| 273 //////////////////////////////////////////////////////////////////////////////// | 274 //////////////////////////////////////////////////////////////////////////////// |
| 274 // SessionStateObserver override. | 275 // SessionStateObserver override. |
| 275 | 276 |
| 276 void WebUIScreenLocker::OnSessionStateEvent( | 277 void WebUIScreenLocker::OnSessionStateEvent( |
| 277 ash::SessionStateObserver::EventType event) { | 278 ash::SessionStateObserver::EventType event) { |
| 278 if (event == ash::SessionStateObserver::EVENT_LOCK_ANIMATION_FINISHED) | 279 if (event == ash::SessionStateObserver::EVENT_LOCK_ANIMATION_FINISHED) { |
| 280 // Release capture if any. |
| 281 aura::client::GetCaptureClient(GetNativeWindow()->GetRootWindow())-> |
| 282 SetCapture(NULL); |
| 279 GetWebUI()->CallJavascriptFunction("cr.ui.Oobe.animateOnceFullyDisplayed"); | 283 GetWebUI()->CallJavascriptFunction("cr.ui.Oobe.animateOnceFullyDisplayed"); |
| 284 } |
| 280 } | 285 } |
| 281 | 286 |
| 282 //////////////////////////////////////////////////////////////////////////////// | 287 //////////////////////////////////////////////////////////////////////////////// |
| 283 // WidgetObserver override. | 288 // WidgetObserver override. |
| 284 | 289 |
| 285 void WebUIScreenLocker::OnWidgetDestroying(views::Widget* widget) { | 290 void WebUIScreenLocker::OnWidgetDestroying(views::Widget* widget) { |
| 286 lock_window_->RemoveObserver(this); | 291 lock_window_->RemoveObserver(this); |
| 287 lock_window_ = NULL; | 292 lock_window_ = NULL; |
| 288 } | 293 } |
| 289 | 294 |
| 290 //////////////////////////////////////////////////////////////////////////////// | 295 //////////////////////////////////////////////////////////////////////////////// |
| 291 // PowerManagerClient::Observer overrides. | 296 // PowerManagerClient::Observer overrides. |
| 292 | 297 |
| 293 void WebUIScreenLocker::LidEventReceived(bool open, | 298 void WebUIScreenLocker::LidEventReceived(bool open, |
| 294 const base::TimeTicks& time) { | 299 const base::TimeTicks& time) { |
| 295 content::BrowserThread::PostTask( | 300 content::BrowserThread::PostTask( |
| 296 content::BrowserThread::UI, | 301 content::BrowserThread::UI, |
| 297 FROM_HERE, | 302 FROM_HERE, |
| 298 base::Bind(&WebUIScreenLocker::FocusUserPod, weak_factory_.GetWeakPtr())); | 303 base::Bind(&WebUIScreenLocker::FocusUserPod, weak_factory_.GetWeakPtr())); |
| 299 } | 304 } |
| 300 | 305 |
| 301 void WebUIScreenLocker::SystemResumed(const base::TimeDelta& sleep_duration) { | 306 void WebUIScreenLocker::SystemResumed(const base::TimeDelta& sleep_duration) { |
| 302 content::BrowserThread::PostTask( | 307 content::BrowserThread::PostTask( |
| 303 content::BrowserThread::UI, | 308 content::BrowserThread::UI, |
| 304 FROM_HERE, | 309 FROM_HERE, |
| 305 base::Bind(&WebUIScreenLocker::FocusUserPod, weak_factory_.GetWeakPtr())); | 310 base::Bind(&WebUIScreenLocker::FocusUserPod, weak_factory_.GetWeakPtr())); |
| 306 } | 311 } |
| 307 | 312 |
| 308 } // namespace chromeos | 313 } // namespace chromeos |
| OLD | NEW |