OLD | NEW |
---|---|
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 "ash/system/chromeos/session/logout_confirmation_dialog.h" | 5 #include "ash/common/system/chromeos/session/logout_confirmation_dialog.h" |
6 | 6 |
7 #include "ash/common/shell_window_ids.h" | |
8 #include "ash/common/system/chromeos/session/logout_confirmation_controller.h" | |
7 #include "ash/common/system/tray/tray_constants.h" | 9 #include "ash/common/system/tray/tray_constants.h" |
8 #include "ash/shell.h" | 10 #include "ash/common/wm_root_window_controller.h" |
9 #include "ash/system/chromeos/session/logout_confirmation_controller.h" | 11 #include "ash/common/wm_shell.h" |
10 #include "base/location.h" | 12 #include "base/location.h" |
11 #include "base/time/tick_clock.h" | 13 #include "base/time/tick_clock.h" |
12 #include "grit/ash_strings.h" | 14 #include "grit/ash_strings.h" |
13 #include "ui/base/l10n/l10n_util.h" | 15 #include "ui/base/l10n/l10n_util.h" |
14 #include "ui/base/l10n/time_format.h" | 16 #include "ui/base/l10n/time_format.h" |
15 #include "ui/base/ui_base_types.h" | 17 #include "ui/base/ui_base_types.h" |
18 #include "ui/gfx/geometry/rect.h" | |
16 #include "ui/gfx/text_constants.h" | 19 #include "ui/gfx/text_constants.h" |
17 #include "ui/views/border.h" | 20 #include "ui/views/border.h" |
18 #include "ui/views/controls/label.h" | 21 #include "ui/views/controls/label.h" |
19 #include "ui/views/layout/fill_layout.h" | 22 #include "ui/views/layout/fill_layout.h" |
20 #include "ui/views/widget/widget.h" | 23 #include "ui/views/widget/widget.h" |
21 | 24 |
22 namespace ash { | 25 namespace ash { |
23 namespace { | 26 namespace { |
24 | 27 |
25 const int kCountdownUpdateIntervalMs = 1000; // 1 second. | 28 const int kCountdownUpdateIntervalMs = 1000; // 1 second. |
(...skipping 10 matching lines...) Expand all Loading... | |
36 | 39 |
37 label_ = new views::Label; | 40 label_ = new views::Label; |
38 label_->SetBorder(views::Border::CreateEmptyBorder( | 41 label_->SetBorder(views::Border::CreateEmptyBorder( |
39 0, kTrayPopupPaddingHorizontal, 0, kTrayPopupPaddingHorizontal)); | 42 0, kTrayPopupPaddingHorizontal, 0, kTrayPopupPaddingHorizontal)); |
40 label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 43 label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
41 label_->SetMultiLine(true); | 44 label_->SetMultiLine(true); |
42 AddChildView(label_); | 45 AddChildView(label_); |
43 | 46 |
44 UpdateLabel(); | 47 UpdateLabel(); |
45 | 48 |
46 CreateDialogWidget(this, ash::Shell::GetPrimaryRootWindow(), NULL); | 49 views::Widget* widget = new views::Widget; |
47 GetWidget()->Show(); | 50 views::Widget::InitParams params = |
51 GetDialogWidgetInitParams(this, nullptr, nullptr, gfx::Rect()); | |
52 WmShell::Get() | |
msw
2016/06/28 19:31:03
aside: I wish this were easier, but I don't see a
James Cook
2016/06/28 20:14:46
Acknowledged.
| |
53 ->GetPrimaryRootWindowController() | |
54 ->ConfigureWidgetInitParamsForContainer( | |
55 widget, kShellWindowId_SystemModalContainer, ¶ms); | |
56 widget->Init(params); | |
57 widget->Show(); | |
48 | 58 |
49 update_timer_.Start( | 59 update_timer_.Start( |
50 FROM_HERE, base::TimeDelta::FromMilliseconds(kCountdownUpdateIntervalMs), | 60 FROM_HERE, base::TimeDelta::FromMilliseconds(kCountdownUpdateIntervalMs), |
51 this, &LogoutConfirmationDialog::UpdateLabel); | 61 this, &LogoutConfirmationDialog::UpdateLabel); |
52 } | 62 } |
53 | 63 |
54 LogoutConfirmationDialog::~LogoutConfirmationDialog() {} | 64 LogoutConfirmationDialog::~LogoutConfirmationDialog() {} |
55 | 65 |
56 void LogoutConfirmationDialog::Update(base::TimeTicks logout_time) { | 66 void LogoutConfirmationDialog::Update(base::TimeTicks logout_time) { |
57 logout_time_ = logout_time; | 67 logout_time_ = logout_time; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
101 ui::TimeFormat::LENGTH_LONG, 10, | 111 ui::TimeFormat::LENGTH_LONG, 10, |
102 time_remaining))); | 112 time_remaining))); |
103 } else { | 113 } else { |
104 label_->SetText( | 114 label_->SetText( |
105 l10n_util::GetStringUTF16(IDS_ASH_LOGOUT_CONFIRMATION_WARNING_NOW)); | 115 l10n_util::GetStringUTF16(IDS_ASH_LOGOUT_CONFIRMATION_WARNING_NOW)); |
106 update_timer_.Stop(); | 116 update_timer_.Stop(); |
107 } | 117 } |
108 } | 118 } |
109 | 119 |
110 } // namespace ash | 120 } // namespace ash |
OLD | NEW |