| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 views::kPanelVertMargin, views::kButtonHEdgeMarginNew, | 62 views::kPanelVertMargin, views::kButtonHEdgeMarginNew, |
| 63 views::kPanelVertMargin, views::kButtonHEdgeMarginNew)); | 63 views::kPanelVertMargin, views::kButtonHEdgeMarginNew)); |
| 64 } else { | 64 } else { |
| 65 content->set_border(views::Border::CreateEmptyBorder( | 65 content->set_border(views::Border::CreateEmptyBorder( |
| 66 views::kPanelVertMargin, views::kPanelHorizMargin, | 66 views::kPanelVertMargin, views::kPanelHorizMargin, |
| 67 views::kPanelVertMargin, views::kPanelHorizMargin)); | 67 views::kPanelVertMargin, views::kPanelHorizMargin)); |
| 68 } | 68 } |
| 69 AddChildView(content); | 69 AddChildView(content); |
| 70 SetLayoutManager(new views::FillLayout()); | 70 SetLayoutManager(new views::FillLayout()); |
| 71 | 71 |
| 72 views::Widget::CreateWindowWithContext(this, | 72 views::DialogDelegate::CreateDialogWidget( |
| 73 ash::Shell::GetPrimaryRootWindow()); | 73 this, ash::Shell::GetPrimaryRootWindow(), NULL)->Show(); |
| 74 GetWidget()->Show(); | |
| 75 } | 74 } |
| 76 | 75 |
| 77 void IdleActionWarningDialogView::Close() { | 76 void IdleActionWarningDialogView::Close() { |
| 78 closing_ = true; | 77 closing_ = true; |
| 79 GetDialogClientView()->CancelWindow(); | 78 GetDialogClientView()->CancelWindow(); |
| 80 } | 79 } |
| 81 | 80 |
| 82 ui::ModalType IdleActionWarningDialogView::GetModalType() const { | 81 ui::ModalType IdleActionWarningDialogView::GetModalType() const { |
| 83 return ui::MODAL_TYPE_SYSTEM; | 82 return ui::MODAL_TYPE_SYSTEM; |
| 84 } | 83 } |
| 85 | 84 |
| 86 string16 IdleActionWarningDialogView::GetWindowTitle() const { | 85 string16 IdleActionWarningDialogView::GetWindowTitle() const { |
| 87 return l10n_util::GetStringUTF16(IDS_IDLE_WARNING_TITLE); | 86 return l10n_util::GetStringUTF16(IDS_IDLE_WARNING_TITLE); |
| 88 } | 87 } |
| 89 | 88 |
| 90 int IdleActionWarningDialogView::GetDialogButtons() const { | 89 int IdleActionWarningDialogView::GetDialogButtons() const { |
| 91 return ui::DIALOG_BUTTON_NONE; | 90 return ui::DIALOG_BUTTON_NONE; |
| 92 } | 91 } |
| 93 | 92 |
| 94 bool IdleActionWarningDialogView::Cancel() { | 93 bool IdleActionWarningDialogView::Cancel() { |
| 95 return closing_; | 94 return closing_; |
| 96 } | 95 } |
| 97 | 96 |
| 98 IdleActionWarningDialogView::~IdleActionWarningDialogView() { | 97 IdleActionWarningDialogView::~IdleActionWarningDialogView() { |
| 99 } | 98 } |
| 100 | 99 |
| 101 } // namespace chromeos | 100 } // namespace chromeos |
| OLD | NEW |