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

Side by Side 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: Created 3 years, 7 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 unified diff | Download patch
« ash/login/ui/lock_screen.h ('K') | « ash/login/ui/lock_screen.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
OLDNEW
« ash/login/ui/lock_screen.h ('K') | « ash/login/ui/lock_screen.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698