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

Side by Side Diff: athena/system/power_button_controller.cc

Issue 620663005: Lock screen for Chrome-Athena (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed crash Created 6 years, 2 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "athena/system/power_button_controller.h" 5 #include "athena/system/power_button_controller.h"
6 6
7 #include "athena/screen/public/screen_manager.h" 7 #include "athena/screen/public/screen_manager.h"
8 #include "athena/screen_lock/public/screen_lock_manager.h"
8 #include "athena/strings/grit/athena_strings.h" 9 #include "athena/strings/grit/athena_strings.h"
9 #include "chromeos/dbus/dbus_thread_manager.h" 10 #include "chromeos/dbus/dbus_thread_manager.h"
10 #include "ui/base/l10n/l10n_util.h" 11 #include "ui/base/l10n/l10n_util.h"
11 #include "ui/gfx/font_list.h" 12 #include "ui/gfx/font_list.h"
12 #include "ui/views/background.h" 13 #include "ui/views/background.h"
13 #include "ui/views/border.h" 14 #include "ui/views/border.h"
14 #include "ui/views/controls/label.h" 15 #include "ui/views/controls/label.h"
15 #include "ui/views/layout/box_layout.h" 16 #include "ui/views/layout/box_layout.h"
16 #include "ui/views/widget/widget.h" 17 #include "ui/views/widget/widget.h"
17 18
(...skipping 19 matching lines...) Expand all
37 } 38 }
38 39
39 PowerButtonController::~PowerButtonController() { 40 PowerButtonController::~PowerButtonController() {
40 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver( 41 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(
41 this); 42 this);
42 } 43 }
43 44
44 void PowerButtonController::ShowShutdownWarningDialog() { 45 void PowerButtonController::ShowShutdownWarningDialog() {
45 state_ = STATE_SHUTDOWN_WARNING_VISIBLE; 46 state_ = STATE_SHUTDOWN_WARNING_VISIBLE;
46 47
48 // Lock screen manager exists inside user session only.
49 if (athena::ScreenLockManager::Get())
50 athena::ScreenLockManager::Get()->LockScreen();
Jun Mukai 2014/10/13 18:20:24 Return here? Otherwise normal shutdown process wi
Dmitry Polukhin 2014/10/14 11:20:33 No return here to show dialog that keeping power b
Jun Mukai 2014/10/14 18:27:25 Ah, I see.
51
47 shutdown_warning_message_.reset(new views::Widget); 52 shutdown_warning_message_.reset(new views::Widget);
48 53
49 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); 54 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP);
50 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 55 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
51 params.parent = warning_message_container_; 56 params.parent = warning_message_container_;
52 shutdown_warning_message_->Init(params); 57 shutdown_warning_message_->Init(params);
53 58
54 views::Label* label = 59 views::Label* label =
55 new views::Label(l10n_util::GetStringUTF16(IDS_ATHENA_SHUTDOWN_WARNING)); 60 new views::Label(l10n_util::GetStringUTF16(IDS_ATHENA_SHUTDOWN_WARNING));
56 label->SetBackgroundColor(SK_ColorWHITE); 61 label->SetBackgroundColor(SK_ColorWHITE);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 ->GetPowerManagerClient() 122 ->GetPowerManagerClient()
118 ->RequestSuspend(); 123 ->RequestSuspend();
119 } 124 }
120 state_ = STATE_OTHER; 125 state_ = STATE_OTHER;
121 timer_.Stop(); 126 timer_.Stop();
122 shutdown_warning_message_.reset(); 127 shutdown_warning_message_.reset();
123 } 128 }
124 } 129 }
125 130
126 } // namespace athena 131 } // namespace athena
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698