OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/chromeos/power/idle_action_warning_dialog_view.h" | 5 #include "chrome/browser/chromeos/power/idle_action_warning_dialog_view.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "grit/generated_resources.h" | 8 #include "grit/generated_resources.h" |
9 #include "ui/aura/root_window.h" | 9 #include "ui/aura/root_window.h" |
10 #include "ui/base/l10n/l10n_util.h" | 10 #include "ui/base/l10n/l10n_util.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 gfx::Size FixedWidthLabel::GetPreferredSize() { | 50 gfx::Size FixedWidthLabel::GetPreferredSize() { |
51 return gfx::Size(width_, GetHeightForWidth(width_)); | 51 return gfx::Size(width_, GetHeightForWidth(width_)); |
52 } | 52 } |
53 | 53 |
54 } // namespace | 54 } // namespace |
55 | 55 |
56 IdleActionWarningDialogView::IdleActionWarningDialogView() : closing_(false) { | 56 IdleActionWarningDialogView::IdleActionWarningDialogView() : closing_(false) { |
57 FixedWidthLabel* content = new FixedWidthLabel( | 57 FixedWidthLabel* content = new FixedWidthLabel( |
58 l10n_util::GetStringUTF16(IDS_IDLE_WARNING_LOGOUT_WARNING), | 58 l10n_util::GetStringUTF16(IDS_IDLE_WARNING_LOGOUT_WARNING), |
59 kIdleActionWarningContentWidth); | 59 kIdleActionWarningContentWidth); |
60 if (DialogDelegate::UseNewStyle()) { | 60 content->set_border(views::Border::CreateEmptyBorder( |
61 content->set_border(views::Border::CreateEmptyBorder( | 61 views::kPanelVertMargin, views::kButtonHEdgeMarginNew, |
62 views::kPanelVertMargin, views::kButtonHEdgeMarginNew, | 62 views::kPanelVertMargin, views::kButtonHEdgeMarginNew)); |
63 views::kPanelVertMargin, views::kButtonHEdgeMarginNew)); | |
64 } else { | |
65 content->set_border(views::Border::CreateEmptyBorder( | |
66 views::kPanelVertMargin, views::kPanelHorizMargin, | |
67 views::kPanelVertMargin, views::kPanelHorizMargin)); | |
68 } | |
69 AddChildView(content); | 63 AddChildView(content); |
70 SetLayoutManager(new views::FillLayout()); | 64 SetLayoutManager(new views::FillLayout()); |
71 | 65 |
72 views::DialogDelegate::CreateDialogWidget( | 66 views::DialogDelegate::CreateDialogWidget( |
73 this, ash::Shell::GetPrimaryRootWindow(), NULL)->Show(); | 67 this, ash::Shell::GetPrimaryRootWindow(), NULL)->Show(); |
74 } | 68 } |
75 | 69 |
76 void IdleActionWarningDialogView::CloseDialog() { | 70 void IdleActionWarningDialogView::CloseDialog() { |
77 closing_ = true; | 71 closing_ = true; |
78 GetDialogClientView()->CancelWindow(); | 72 GetDialogClientView()->CancelWindow(); |
(...skipping 12 matching lines...) Expand all Loading... |
91 } | 85 } |
92 | 86 |
93 bool IdleActionWarningDialogView::Cancel() { | 87 bool IdleActionWarningDialogView::Cancel() { |
94 return closing_; | 88 return closing_; |
95 } | 89 } |
96 | 90 |
97 IdleActionWarningDialogView::~IdleActionWarningDialogView() { | 91 IdleActionWarningDialogView::~IdleActionWarningDialogView() { |
98 } | 92 } |
99 | 93 |
100 } // namespace chromeos | 94 } // namespace chromeos |
OLD | NEW |