Chromium Code Reviews| 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 "ui/display/display.h" | 9 #include "ui/display/display.h" |
| 10 #include "ui/display/screen.h" | 10 #include "ui/display/screen.h" |
| 11 #include "ui/views/widget/widget.h" | 11 #include "ui/views/widget/widget.h" |
| 12 | 12 |
| 13 namespace ash { | 13 namespace ash { |
| 14 | 14 |
| 15 namespace { | |
| 16 // Reference to global lock screen instance. There can only ever be one lock | |
| 17 // screen display at the same time. | |
| 18 LockWindow* window_ = nullptr; | |
|
xiyuan
2017/06/06 22:37:52
Just call it |window| or |g_window|. No trailing "
jdufault
2017/06/07 18:58:35
Done.
| |
| 19 } // namespace | |
| 20 | |
| 15 bool ShowLockScreen() { | 21 bool ShowLockScreen() { |
| 16 LockWindow* window = new LockWindow(); | 22 CHECK(!window_); |
| 17 window->SetBounds(display::Screen::GetScreen()->GetPrimaryDisplay().bounds()); | 23 window_ = new LockWindow(); |
| 24 window_->SetBounds( | |
| 25 display::Screen::GetScreen()->GetPrimaryDisplay().bounds()); | |
| 18 | 26 |
| 19 views::View* contents = new LockContentsView(); | 27 auto* contents = new LockContentsView(); |
| 20 window->SetContentsView(contents); | 28 window_->SetContentsView(contents); |
| 21 window->Show(); | 29 window_->Show(); |
| 22 | 30 |
| 23 return true; | 31 return true; |
| 24 } | 32 } |
| 25 | 33 |
| 34 void DestroyLockScreen() { | |
| 35 CHECK(window_); | |
| 36 window_->Close(); | |
| 37 window_ = nullptr; | |
| 38 } | |
| 39 | |
| 26 } // namespace ash | 40 } // namespace ash |
| OLD | NEW |