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

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: Add new mojo calls 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
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..49c27d4fbfb966d153210d8a610a980a74096298 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* 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.
+} // namespace
+
bool ShowLockScreen() {
- LockWindow* window = new LockWindow();
- window->SetBounds(display::Screen::GetScreen()->GetPrimaryDisplay().bounds());
+ CHECK(!window_);
+ window_ = new LockWindow();
+ window_->SetBounds(
+ display::Screen::GetScreen()->GetPrimaryDisplay().bounds());
- views::View* contents = new LockContentsView();
- window->SetContentsView(contents);
- window->Show();
+ auto* contents = new LockContentsView();
+ window_->SetContentsView(contents);
+ window_->Show();
return true;
}
+void DestroyLockScreen() {
+ CHECK(window_);
+ window_->Close();
+ window_ = nullptr;
+}
+
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698