| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/feature_list.h" | 8 #include "base/feature_list.h" |
| 9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 | 144 |
| 145 ResetKeyboardOverscrollOverride(); | 145 ResetKeyboardOverscrollOverride(); |
| 146 | 146 |
| 147 RequestPreload(); | 147 RequestPreload(); |
| 148 } | 148 } |
| 149 | 149 |
| 150 void WebUIScreenLocker::LockScreen() { | 150 void WebUIScreenLocker::LockScreen() { |
| 151 gfx::Rect bounds = display::Screen::GetScreen()->GetPrimaryDisplay().bounds(); | 151 gfx::Rect bounds = display::Screen::GetScreen()->GetPrimaryDisplay().bounds(); |
| 152 | 152 |
| 153 lock_time_ = base::TimeTicks::Now(); | 153 lock_time_ = base::TimeTicks::Now(); |
| 154 lock_window_ = new LockWindow(this); | 154 lock_window_ = new LockWindow(); |
| 155 lock_window_->AddObserver(this); | 155 lock_window_->AddObserver(this); |
| 156 | 156 |
| 157 Init(); | 157 Init(); |
| 158 content::WebContentsObserver::Observe(web_view()->GetWebContents()); | 158 content::WebContentsObserver::Observe(web_view()->GetWebContents()); |
| 159 | 159 |
| 160 lock_window_->SetContentsView(this); | 160 lock_window_->SetContentsView(this); |
| 161 lock_window_->SetBounds(bounds); | 161 lock_window_->SetBounds(bounds); |
| 162 lock_window_->Show(); | 162 lock_window_->Show(); |
| 163 LoadURL(GURL(kLoginURL)); | 163 LoadURL(GURL(kLoginURL)); |
| 164 OnLockWindowReady(); | 164 OnLockWindowReady(); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 } | 259 } |
| 260 | 260 |
| 261 void WebUIScreenLocker::OnAshLockAnimationFinished() { | 261 void WebUIScreenLocker::OnAshLockAnimationFinished() { |
| 262 // Release capture if any. | 262 // Release capture if any. |
| 263 aura::client::GetCaptureClient(GetNativeWindow()->GetRootWindow()) | 263 aura::client::GetCaptureClient(GetNativeWindow()->GetRootWindow()) |
| 264 ->SetCapture(nullptr); | 264 ->SetCapture(nullptr); |
| 265 GetWebUI()->CallJavascriptFunctionUnsafe( | 265 GetWebUI()->CallJavascriptFunctionUnsafe( |
| 266 "cr.ui.Oobe.animateOnceFullyDisplayed"); | 266 "cr.ui.Oobe.animateOnceFullyDisplayed"); |
| 267 } | 267 } |
| 268 | 268 |
| 269 void WebUIScreenLocker::SetFingerprintState(const AccountId& account_id, | 269 void WebUIScreenLocker::SetFingerprintState( |
| 270 FingerprintState state) { | 270 const AccountId& account_id, |
| 271 ScreenLocker::FingerprintState state) { |
| 271 // TODO(xiaoyinh@): Modify JS side to consolidate removeUserPodFingerprintIcon | 272 // TODO(xiaoyinh@): Modify JS side to consolidate removeUserPodFingerprintIcon |
| 272 // and setUserPodFingerprintIcon into single JS function. | 273 // and setUserPodFingerprintIcon into single JS function. |
| 273 if (state == FingerprintState::kRemoved) { | 274 if (state == ScreenLocker::FingerprintState::kRemoved) { |
| 274 GetWebUI()->CallJavascriptFunctionUnsafe( | 275 GetWebUI()->CallJavascriptFunctionUnsafe( |
| 275 "login.AccountPickerScreen.removeUserPodFingerprintIcon", | 276 "login.AccountPickerScreen.removeUserPodFingerprintIcon", |
| 276 ::login::MakeValue(account_id)); | 277 ::login::MakeValue(account_id)); |
| 277 return; | 278 return; |
| 278 } | 279 } |
| 279 | 280 |
| 280 chromeos::quick_unlock::QuickUnlockStorage* quick_unlock_storage = | 281 chromeos::quick_unlock::QuickUnlockStorage* quick_unlock_storage = |
| 281 chromeos::quick_unlock::QuickUnlockFactory::GetForAccountId(account_id); | 282 chromeos::quick_unlock::QuickUnlockFactory::GetForAccountId(account_id); |
| 282 if (!quick_unlock_storage || | 283 if (!quick_unlock_storage || |
| 283 !quick_unlock_storage->IsFingerprintAuthenticationAvailable()) { | 284 !quick_unlock_storage->IsFingerprintAuthenticationAvailable()) { |
| 284 state = FingerprintState::kHidden; | 285 state = ScreenLocker::FingerprintState::kHidden; |
| 285 } | 286 } |
| 286 GetWebUI()->CallJavascriptFunctionUnsafe( | 287 GetWebUI()->CallJavascriptFunctionUnsafe( |
| 287 "login.AccountPickerScreen.setUserPodFingerprintIcon", | 288 "login.AccountPickerScreen.setUserPodFingerprintIcon", |
| 288 ::login::MakeValue(account_id), | 289 ::login::MakeValue(account_id), |
| 289 ::login::MakeValue(static_cast<int>(state))); | 290 ::login::MakeValue(static_cast<int>(state))); |
| 290 } | 291 } |
| 291 | 292 |
| 293 content::WebContents* WebUIScreenLocker::GetWebContents() { |
| 294 return WebUILoginView::GetWebContents(); |
| 295 } |
| 296 |
| 292 //////////////////////////////////////////////////////////////////////////////// | 297 //////////////////////////////////////////////////////////////////////////////// |
| 293 // WebUIScreenLocker, LoginDisplay::Delegate: | 298 // WebUIScreenLocker, LoginDisplay::Delegate: |
| 294 | 299 |
| 295 void WebUIScreenLocker::CancelPasswordChangedFlow() { | 300 void WebUIScreenLocker::CancelPasswordChangedFlow() { |
| 296 NOTREACHED(); | 301 NOTREACHED(); |
| 297 } | 302 } |
| 298 | 303 |
| 299 void WebUIScreenLocker::CompleteLogin(const UserContext& user_context) { | 304 void WebUIScreenLocker::CompleteLogin(const UserContext& user_context) { |
| 300 NOTREACHED(); | 305 NOTREACHED(); |
| 301 } | 306 } |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 } | 436 } |
| 432 | 437 |
| 433 if (GetOobeUI()) { | 438 if (GetOobeUI()) { |
| 434 const gfx::Size& size = primary_display.size(); | 439 const gfx::Size& size = primary_display.size(); |
| 435 GetOobeUI()->GetCoreOobeView()->SetClientAreaSize(size.width(), | 440 GetOobeUI()->GetCoreOobeView()->SetClientAreaSize(size.width(), |
| 436 size.height()); | 441 size.height()); |
| 437 } | 442 } |
| 438 } | 443 } |
| 439 | 444 |
| 440 } // namespace chromeos | 445 } // namespace chromeos |
| OLD | NEW |