| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/chromeos/cros/cros_library.h" | 10 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 11 #include "chrome/browser/chromeos/cros/network_library.h" | 11 #include "chrome/browser/chromeos/cros/network_library.h" |
| 12 #include "chrome/browser/chromeos/login/helper.h" | 12 #include "chrome/browser/chromeos/login/helper.h" |
| 13 #include "chrome/browser/chromeos/login/screen_locker.h" | 13 #include "chrome/browser/chromeos/login/screen_locker.h" |
| 14 #include "chrome/browser/chromeos/login/user_manager.h" | 14 #include "chrome/browser/chromeos/login/user_manager.h" |
| 15 #include "chrome/browser/chromeos/login/webui_login_display.h" | 15 #include "chrome/browser/chromeos/login/webui_login_display.h" |
| 16 #include "chrome/browser/chromeos/status/status_area_view_chromeos.h" | |
| 17 #include "chrome/browser/ui/views/dom_view.h" | 16 #include "chrome/browser/ui/views/dom_view.h" |
| 18 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 17 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
| 19 #include "chrome/common/chrome_notification_types.h" | 18 #include "chrome/common/chrome_notification_types.h" |
| 20 #include "chrome/common/url_constants.h" | 19 #include "chrome/common/url_constants.h" |
| 21 #include "content/public/browser/notification_service.h" | 20 #include "content/public/browser/notification_service.h" |
| 22 #include "content/public/browser/notification_types.h" | 21 #include "content/public/browser/notification_types.h" |
| 23 #include "content/public/browser/render_widget_host_view.h" | 22 #include "content/public/browser/render_widget_host_view.h" |
| 24 #include "content/public/browser/web_ui.h" | 23 #include "content/public/browser/web_ui.h" |
| 25 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
| 26 #include "ui/base/x/x11_util.h" | 25 #include "ui/base/x/x11_util.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 void WebUIScreenLocker::ScreenLockReady() { | 77 void WebUIScreenLocker::ScreenLockReady() { |
| 79 ScreenLockerDelegate::ScreenLockReady(); | 78 ScreenLockerDelegate::ScreenLockReady(); |
| 80 SetInputEnabled(true); | 79 SetInputEnabled(true); |
| 81 } | 80 } |
| 82 | 81 |
| 83 void WebUIScreenLocker::OnAuthenticate() { | 82 void WebUIScreenLocker::OnAuthenticate() { |
| 84 } | 83 } |
| 85 | 84 |
| 86 void WebUIScreenLocker::SetInputEnabled(bool enabled) { | 85 void WebUIScreenLocker::SetInputEnabled(bool enabled) { |
| 87 login_display_->SetUIEnabled(enabled); | 86 login_display_->SetUIEnabled(enabled); |
| 88 SetStatusAreaEnabled(enabled); | |
| 89 } | 87 } |
| 90 | 88 |
| 91 void WebUIScreenLocker::ShowErrorMessage( | 89 void WebUIScreenLocker::ShowErrorMessage( |
| 92 int error_msg_id, | 90 int error_msg_id, |
| 93 HelpAppLauncher::HelpTopic help_topic_id) { | 91 HelpAppLauncher::HelpTopic help_topic_id) { |
| 94 login_display_->ShowError(error_msg_id, | 92 login_display_->ShowError(error_msg_id, |
| 95 0 /* login_attempts */, | 93 0 /* login_attempts */, |
| 96 help_topic_id); | 94 help_topic_id); |
| 97 } | 95 } |
| 98 | 96 |
| 99 void WebUIScreenLocker::ClearErrors() { | 97 void WebUIScreenLocker::ClearErrors() { |
| 100 GetWebUI()->CallJavascriptFunction("cr.ui.Oobe.clearErrors"); | 98 GetWebUI()->CallJavascriptFunction("cr.ui.Oobe.clearErrors"); |
| 101 } | 99 } |
| 102 | 100 |
| 103 gfx::NativeWindow WebUIScreenLocker::GetNativeWindow() const { | 101 gfx::NativeWindow WebUIScreenLocker::GetNativeWindow() const { |
| 104 return lock_window_->GetNativeWindow(); | 102 return lock_window_->GetNativeWindow(); |
| 105 } | 103 } |
| 106 | 104 |
| 107 WebUIScreenLocker::~WebUIScreenLocker() { | 105 WebUIScreenLocker::~WebUIScreenLocker() { |
| 108 DCHECK(lock_window_); | 106 DCHECK(lock_window_); |
| 109 lock_window_->Close(); | 107 lock_window_->Close(); |
| 110 // If LockScreen() was called, we need to clear the signin screen handler | 108 // If LockScreen() was called, we need to clear the signin screen handler |
| 111 // delegate set in ShowSigninScreen so that it no longer points to us. | 109 // delegate set in ShowSigninScreen so that it no longer points to us. |
| 112 if (login_display_.get()) { | 110 if (login_display_.get()) { |
| 113 static_cast<OobeUI*>(GetWebUI()->GetController())-> | 111 static_cast<OobeUI*>(GetWebUI()->GetController())-> |
| 114 ResetSigninScreenHandlerDelegate(); | 112 ResetSigninScreenHandlerDelegate(); |
| 115 } | 113 } |
| 116 // WebUILoginView::OnTabMainFrameFirstRender sets the screen mode to | |
| 117 // WebUIScreenLocker::GetScreenMode() = SCREEN_LOCKER_MODE. We need to reset | |
| 118 // the screen mode when the lock screen is hidden here. | |
| 119 chromeos::StatusAreaViewChromeos::SetScreenMode( | |
| 120 chromeos::StatusAreaViewChromeos::BROWSER_MODE); | |
| 121 SetStatusAreaEnabled(true); | |
| 122 } | 114 } |
| 123 | 115 |
| 124 //////////////////////////////////////////////////////////////////////////////// | 116 //////////////////////////////////////////////////////////////////////////////// |
| 125 // WebUIScreenLocker, content::NotificationObserver implementation: | 117 // WebUIScreenLocker, content::NotificationObserver implementation: |
| 126 | 118 |
| 127 void WebUIScreenLocker::Observe( | 119 void WebUIScreenLocker::Observe( |
| 128 int type, | 120 int type, |
| 129 const content::NotificationSource& source, | 121 const content::NotificationSource& source, |
| 130 const content::NotificationDetails& details) { | 122 const content::NotificationDetails& details) { |
| 131 switch (type) { | 123 switch (type) { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 | 184 |
| 193 //////////////////////////////////////////////////////////////////////////////// | 185 //////////////////////////////////////////////////////////////////////////////// |
| 194 // LockWindow::Observer implementation: | 186 // LockWindow::Observer implementation: |
| 195 | 187 |
| 196 void WebUIScreenLocker::OnLockWindowReady() { | 188 void WebUIScreenLocker::OnLockWindowReady() { |
| 197 lock_ready_ = true; | 189 lock_ready_ = true; |
| 198 if (webui_ready_) | 190 if (webui_ready_) |
| 199 ScreenLockReady(); | 191 ScreenLockReady(); |
| 200 } | 192 } |
| 201 | 193 |
| 202 //////////////////////////////////////////////////////////////////////////////// | |
| 203 // Overridden from WebUILoginView: | |
| 204 | |
| 205 StatusAreaViewChromeos::ScreenMode WebUIScreenLocker::GetScreenMode() { | |
| 206 return StatusAreaViewChromeos::SCREEN_LOCKER_MODE; | |
| 207 } | |
| 208 | |
| 209 views::Widget::InitParams::Type WebUIScreenLocker::GetStatusAreaWidgetType() { | |
| 210 return views::Widget::InitParams::TYPE_POPUP; | |
| 211 } | |
| 212 | |
| 213 } // namespace chromeos | 194 } // namespace chromeos |
| OLD | NEW |