Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2676)

Unified Diff: ash/login/ui/lock_screen.cc

Issue 2896093003: cros: Make sure views-based lock screen is destroyed after it is dismissed. (Closed)
Patch Set: Address comments Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/login/ui/lock_screen.h ('k') | ash/public/interfaces/lock_screen.mojom » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/login/ui/lock_screen.cc
diff --git a/ash/login/ui/lock_screen.cc b/ash/login/ui/lock_screen.cc
index baaf5bfd80b602c59fc51ead9cfa6aae0027c8f9..d13311deb0173968ca734781c9425b1768000020 100644
--- a/ash/login/ui/lock_screen.cc
+++ b/ash/login/ui/lock_screen.cc
@@ -12,15 +12,29 @@
namespace ash {
+namespace {
+// Reference to global lock screen instance. There can only ever be one lock
+// screen display at the same time.
+LockWindow* g_window = nullptr;
+} // namespace
+
bool ShowLockScreen() {
- LockWindow* window = new LockWindow();
- window->SetBounds(display::Screen::GetScreen()->GetPrimaryDisplay().bounds());
+ CHECK(!g_window);
+ g_window = new LockWindow();
+ g_window->SetBounds(
+ display::Screen::GetScreen()->GetPrimaryDisplay().bounds());
- views::View* contents = new LockContentsView();
- window->SetContentsView(contents);
- window->Show();
+ auto* contents = new LockContentsView();
+ g_window->SetContentsView(contents);
+ g_window->Show();
return true;
}
+void DestroyLockScreen() {
+ CHECK(g_window);
+ g_window->Close();
+ g_window = nullptr;
+}
+
} // namespace ash
« no previous file with comments | « ash/login/ui/lock_screen.h ('k') | ash/public/interfaces/lock_screen.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698