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

Side by Side Diff: ash/common/system/chromeos/session/logout_confirmation_dialog.cc

Issue 2108793002: mash: Convert system tray logout button to wm common types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more review comments, fix mash_unittests Created 4 years, 5 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 "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"
12 #include "ash/common/wm_window.h"
10 #include "base/location.h" 13 #include "base/location.h"
11 #include "base/time/tick_clock.h" 14 #include "base/time/tick_clock.h"
12 #include "grit/ash_strings.h" 15 #include "grit/ash_strings.h"
13 #include "ui/base/l10n/l10n_util.h" 16 #include "ui/base/l10n/l10n_util.h"
14 #include "ui/base/l10n/time_format.h" 17 #include "ui/base/l10n/time_format.h"
15 #include "ui/base/ui_base_types.h" 18 #include "ui/base/ui_base_types.h"
19 #include "ui/gfx/geometry/rect.h"
16 #include "ui/gfx/text_constants.h" 20 #include "ui/gfx/text_constants.h"
17 #include "ui/views/border.h" 21 #include "ui/views/border.h"
18 #include "ui/views/controls/label.h" 22 #include "ui/views/controls/label.h"
19 #include "ui/views/layout/fill_layout.h" 23 #include "ui/views/layout/fill_layout.h"
20 #include "ui/views/widget/widget.h" 24 #include "ui/views/widget/widget.h"
21 25
22 namespace ash { 26 namespace ash {
23 namespace { 27 namespace {
24 28
25 const int kCountdownUpdateIntervalMs = 1000; // 1 second. 29 const int kCountdownUpdateIntervalMs = 1000; // 1 second.
(...skipping 10 matching lines...) Expand all
36 40
37 label_ = new views::Label; 41 label_ = new views::Label;
38 label_->SetBorder(views::Border::CreateEmptyBorder( 42 label_->SetBorder(views::Border::CreateEmptyBorder(
39 0, kTrayPopupPaddingHorizontal, 0, kTrayPopupPaddingHorizontal)); 43 0, kTrayPopupPaddingHorizontal, 0, kTrayPopupPaddingHorizontal));
40 label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 44 label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
41 label_->SetMultiLine(true); 45 label_->SetMultiLine(true);
42 AddChildView(label_); 46 AddChildView(label_);
43 47
44 UpdateLabel(); 48 UpdateLabel();
45 49
46 CreateDialogWidget(this, ash::Shell::GetPrimaryRootWindow(), NULL); 50 views::Widget* widget = new views::Widget;
47 GetWidget()->Show(); 51 views::Widget::InitParams params =
52 GetDialogWidgetInitParams(this, nullptr, nullptr, gfx::Rect());
53 WmShell::Get()
54 ->GetPrimaryRootWindow()
55 ->GetRootWindowController()
56 ->ConfigureWidgetInitParamsForContainer(
57 widget, kShellWindowId_SystemModalContainer, &params);
58 widget->Init(params);
59 widget->Show();
48 60
49 update_timer_.Start( 61 update_timer_.Start(
50 FROM_HERE, base::TimeDelta::FromMilliseconds(kCountdownUpdateIntervalMs), 62 FROM_HERE, base::TimeDelta::FromMilliseconds(kCountdownUpdateIntervalMs),
51 this, &LogoutConfirmationDialog::UpdateLabel); 63 this, &LogoutConfirmationDialog::UpdateLabel);
52 } 64 }
53 65
54 LogoutConfirmationDialog::~LogoutConfirmationDialog() {} 66 LogoutConfirmationDialog::~LogoutConfirmationDialog() {}
55 67
56 void LogoutConfirmationDialog::Update(base::TimeTicks logout_time) { 68 void LogoutConfirmationDialog::Update(base::TimeTicks logout_time) {
57 logout_time_ = logout_time; 69 logout_time_ = logout_time;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 ui::TimeFormat::LENGTH_LONG, 10, 113 ui::TimeFormat::LENGTH_LONG, 10,
102 time_remaining))); 114 time_remaining)));
103 } else { 115 } else {
104 label_->SetText( 116 label_->SetText(
105 l10n_util::GetStringUTF16(IDS_ASH_LOGOUT_CONFIRMATION_WARNING_NOW)); 117 l10n_util::GetStringUTF16(IDS_ASH_LOGOUT_CONFIRMATION_WARNING_NOW));
106 update_timer_.Stop(); 118 update_timer_.Stop();
107 } 119 }
108 } 120 }
109 121
110 } // namespace ash 122 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698