| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "ash/login/ui/lock_screen.h" | 5 #include "ash/login/ui/lock_screen.h" |
| 6 | 6 |
| 7 #include "ash/login/ui/lock_contents_view.h" | 7 #include "ash/login/ui/lock_contents_view.h" |
| 8 #include "ash/login/ui/lock_window.h" | 8 #include "ash/login/ui/lock_window.h" |
| 9 #include "components/user_manager/user_manager.h" |
| 9 #include "ui/display/display.h" | 10 #include "ui/display/display.h" |
| 10 #include "ui/display/screen.h" | 11 #include "ui/display/screen.h" |
| 11 #include "ui/views/widget/widget.h" | 12 #include "ui/views/widget/widget.h" |
| 12 | 13 |
| 13 namespace ash { | 14 namespace ash { |
| 14 | 15 |
| 16 namespace { |
| 17 // Reference to global lock screen instance. There can only ever be one lock |
| 18 // screen display at the same time. |
| 19 LockWindow* window_ = nullptr; |
| 20 } // namespace |
| 21 |
| 15 bool ShowLockScreen() { | 22 bool ShowLockScreen() { |
| 16 LockWindow* window = new LockWindow(); | 23 CHECK(!window_); |
| 17 window->SetBounds(display::Screen::GetScreen()->GetPrimaryDisplay().bounds()); | 24 window_ = new LockWindow(); |
| 25 window_->SetBounds( |
| 26 display::Screen::GetScreen()->GetPrimaryDisplay().bounds()); |
| 18 | 27 |
| 19 views::View* contents = new LockContentsView(); | 28 auto* contents = new LockContentsView(); |
| 20 window->SetContentsView(contents); | 29 |
| 21 window->Show(); | 30 window_->SetContentsView(contents); |
| 31 window_->Show(); |
| 22 | 32 |
| 23 return true; | 33 return true; |
| 24 } | 34 } |
| 25 | 35 |
| 36 void DestroyLockScreen() { |
| 37 CHECK(window_); |
| 38 window_->Close(); |
| 39 window_ = nullptr; |
| 40 } |
| 41 |
| 26 } // namespace ash | 42 } // namespace ash |
| OLD | NEW |