| 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 "chrome/browser/chromeos/profiles/multiprofiles_session_aborted_dialog.
h" | 5 #include "chrome/browser/chromeos/profiles/multiprofiles_session_aborted_dialog.
h" |
| 6 | 6 |
| 7 #include "ash/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
| 8 #include "ash/shelf/wm_shelf.h" | 8 #include "ash/shelf/wm_shelf.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "chrome/browser/lifetime/application_lifetime.h" | 12 #include "chrome/browser/lifetime/application_lifetime.h" |
| 13 #include "chrome/grit/generated_resources.h" | 13 #include "chrome/grit/generated_resources.h" |
| 14 #include "ui/base/l10n/l10n_util.h" | 14 #include "ui/base/l10n/l10n_util.h" |
| 15 #include "ui/base/resource/resource_bundle.h" | 15 #include "ui/base/resource/resource_bundle.h" |
| 16 #include "ui/views/border.h" |
| 16 #include "ui/views/controls/button/checkbox.h" | 17 #include "ui/views/controls/button/checkbox.h" |
| 17 #include "ui/views/controls/label.h" | 18 #include "ui/views/controls/label.h" |
| 18 #include "ui/views/layout/grid_layout.h" | 19 #include "ui/views/layout/grid_layout.h" |
| 19 #include "ui/views/widget/widget.h" | 20 #include "ui/views/widget/widget.h" |
| 20 #include "ui/views/window/dialog_delegate.h" | 21 #include "ui/views/window/dialog_delegate.h" |
| 21 | 22 |
| 22 namespace chromeos { | 23 namespace chromeos { |
| 23 | 24 |
| 24 namespace { | 25 namespace { |
| 25 | 26 |
| 26 // Default width/height of the dialog. | 27 // Default width/height of the dialog. |
| 27 const int kDefaultWidth = 600; | 28 const int kDefaultWidth = 600; |
| 28 const int kDefaultHeight = 250; | 29 const int kDefaultHeight = 250; |
| 29 | 30 |
| 30 const int kPaddingToMessage = 20; | 31 const int kPaddingToMessage = 20; |
| 31 const int kInset = 40; | |
| 32 const int kTopInset = 10; | |
| 33 | 32 |
| 34 //////////////////////////////////////////////////////////////////////////////// | 33 //////////////////////////////////////////////////////////////////////////////// |
| 35 // Dialog for an aborted multi-profile session due to a user policy change . | 34 // Dialog for an aborted multi-profile session due to a user policy change . |
| 36 class MultiprofilesSessionAbortedView : public views::DialogDelegateView { | 35 class MultiprofilesSessionAbortedView : public views::DialogDelegateView { |
| 37 public: | 36 public: |
| 38 MultiprofilesSessionAbortedView(); | 37 MultiprofilesSessionAbortedView(); |
| 39 ~MultiprofilesSessionAbortedView() override; | 38 ~MultiprofilesSessionAbortedView() override; |
| 40 | 39 |
| 41 static void ShowDialog(const std::string& user_email); | 40 static void ShowDialog(const std::string& user_email); |
| 42 | 41 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 ui::ModalType MultiprofilesSessionAbortedView::GetModalType() const { | 105 ui::ModalType MultiprofilesSessionAbortedView::GetModalType() const { |
| 107 return ui::MODAL_TYPE_SYSTEM; | 106 return ui::MODAL_TYPE_SYSTEM; |
| 108 } | 107 } |
| 109 | 108 |
| 110 gfx::Size MultiprofilesSessionAbortedView::GetPreferredSize() const { | 109 gfx::Size MultiprofilesSessionAbortedView::GetPreferredSize() const { |
| 111 return gfx::Size(kDefaultWidth, kDefaultHeight); | 110 return gfx::Size(kDefaultWidth, kDefaultHeight); |
| 112 } | 111 } |
| 113 | 112 |
| 114 void MultiprofilesSessionAbortedView::InitDialog( | 113 void MultiprofilesSessionAbortedView::InitDialog( |
| 115 const std::string& user_email) { | 114 const std::string& user_email) { |
| 116 const gfx::Insets kDialogInsets(kTopInset, kInset, kInset, kInset); | 115 constexpr int kTopInset = 10; |
| 117 | 116 constexpr int kOtherInset = 40; |
| 118 // Create the views and layout manager and set them up. | 117 // Create the views and layout manager and set them up. |
| 119 views::GridLayout* grid_layout = views::GridLayout::CreatePanel(this); | 118 views::GridLayout* grid_layout = new views::GridLayout(this); |
| 120 grid_layout->SetInsets(kDialogInsets); | 119 SetLayoutManager(grid_layout); |
| 120 SetBorder(views::CreateEmptyBorder(kTopInset, kOtherInset, kOtherInset, |
| 121 kOtherInset)); |
| 121 | 122 |
| 122 views::ColumnSet* column_set = grid_layout->AddColumnSet(0); | 123 views::ColumnSet* column_set = grid_layout->AddColumnSet(0); |
| 123 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1, | 124 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1, |
| 124 views::GridLayout::USE_PREF, 0, 0); | 125 views::GridLayout::USE_PREF, 0, 0); |
| 125 | 126 |
| 126 views::Label* title_label_ = new views::Label( | 127 views::Label* title_label_ = new views::Label( |
| 127 l10n_util::GetStringUTF16(IDS_MULTIPROFILES_SESSION_ABORT_HEADLINE)); | 128 l10n_util::GetStringUTF16(IDS_MULTIPROFILES_SESSION_ABORT_HEADLINE)); |
| 128 title_label_->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList( | 129 title_label_->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList( |
| 129 ui::ResourceBundle::MediumBoldFont)); | 130 ui::ResourceBundle::MediumBoldFont)); |
| 130 title_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 131 title_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 151 } // namespace | 152 } // namespace |
| 152 | 153 |
| 153 //////////////////////////////////////////////////////////////////////////////// | 154 //////////////////////////////////////////////////////////////////////////////// |
| 154 // Factory function. | 155 // Factory function. |
| 155 | 156 |
| 156 void ShowMultiprofilesSessionAbortedDialog(const std::string& user_email) { | 157 void ShowMultiprofilesSessionAbortedDialog(const std::string& user_email) { |
| 157 MultiprofilesSessionAbortedView::ShowDialog(user_email); | 158 MultiprofilesSessionAbortedView::ShowDialog(user_email); |
| 158 } | 159 } |
| 159 | 160 |
| 160 } // namespace chromeos | 161 } // namespace chromeos |
| OLD | NEW |