Chromium Code Reviews| 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" |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 21 | 21 |
| 22 namespace chromeos { | 22 namespace chromeos { |
| 23 | 23 |
| 24 namespace { | 24 namespace { |
| 25 | 25 |
| 26 // Default width/height of the dialog. | 26 // Default width/height of the dialog. |
| 27 const int kDefaultWidth = 600; | 27 const int kDefaultWidth = 600; |
| 28 const int kDefaultHeight = 250; | 28 const int kDefaultHeight = 250; |
| 29 | 29 |
| 30 const int kPaddingToMessage = 20; | 30 const int kPaddingToMessage = 20; |
| 31 const int kInset = 40; | |
| 32 const int kTopInset = 10; | |
| 33 | 31 |
| 34 //////////////////////////////////////////////////////////////////////////////// | 32 //////////////////////////////////////////////////////////////////////////////// |
| 35 // Dialog for an aborted multi-profile session due to a user policy change . | 33 // Dialog for an aborted multi-profile session due to a user policy change . |
| 36 class MultiprofilesSessionAbortedView : public views::DialogDelegateView { | 34 class MultiprofilesSessionAbortedView : public views::DialogDelegateView { |
| 37 public: | 35 public: |
| 38 MultiprofilesSessionAbortedView(); | 36 MultiprofilesSessionAbortedView(); |
| 39 ~MultiprofilesSessionAbortedView() override; | 37 ~MultiprofilesSessionAbortedView() override; |
| 40 | 38 |
| 41 static void ShowDialog(const std::string& user_email); | 39 static void ShowDialog(const std::string& user_email); |
| 42 | 40 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 106 ui::ModalType MultiprofilesSessionAbortedView::GetModalType() const { | 104 ui::ModalType MultiprofilesSessionAbortedView::GetModalType() const { |
| 107 return ui::MODAL_TYPE_SYSTEM; | 105 return ui::MODAL_TYPE_SYSTEM; |
| 108 } | 106 } |
| 109 | 107 |
| 110 gfx::Size MultiprofilesSessionAbortedView::GetPreferredSize() const { | 108 gfx::Size MultiprofilesSessionAbortedView::GetPreferredSize() const { |
| 111 return gfx::Size(kDefaultWidth, kDefaultHeight); | 109 return gfx::Size(kDefaultWidth, kDefaultHeight); |
| 112 } | 110 } |
| 113 | 111 |
| 114 void MultiprofilesSessionAbortedView::InitDialog( | 112 void MultiprofilesSessionAbortedView::InitDialog( |
| 115 const std::string& user_email) { | 113 const std::string& user_email) { |
| 116 const gfx::Insets kDialogInsets(kTopInset, kInset, kInset, kInset); | 114 constexpr int kTopInset = 10; |
| 117 | 115 constexpr int kInset = 40; |
|
sky
2017/05/05 14:36:39
optional: kInset is rather generic, maybe kOtherIn
Bret
2017/05/06 00:36:43
Done.
| |
| 118 // Create the views and layout manager and set them up. | 116 // Create the views and layout manager and set them up. |
| 119 views::GridLayout* grid_layout = views::GridLayout::CreatePanel(this); | 117 views::GridLayout* grid_layout = views::GridLayout::CreatePanel(this); |
|
sky
2017/05/05 14:36:39
As the next line sets the border, how about not us
Bret
2017/05/06 00:36:43
Done. Though like in the previous patch, my plan i
| |
| 120 grid_layout->SetInsets(kDialogInsets); | 118 SetBorder(CreateEmptyBorder(kTopInset, kInset, kInset, kInset)); |
| 121 | 119 |
| 122 views::ColumnSet* column_set = grid_layout->AddColumnSet(0); | 120 views::ColumnSet* column_set = grid_layout->AddColumnSet(0); |
| 123 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1, | 121 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1, |
| 124 views::GridLayout::USE_PREF, 0, 0); | 122 views::GridLayout::USE_PREF, 0, 0); |
| 125 | 123 |
| 126 views::Label* title_label_ = new views::Label( | 124 views::Label* title_label_ = new views::Label( |
| 127 l10n_util::GetStringUTF16(IDS_MULTIPROFILES_SESSION_ABORT_HEADLINE)); | 125 l10n_util::GetStringUTF16(IDS_MULTIPROFILES_SESSION_ABORT_HEADLINE)); |
| 128 title_label_->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList( | 126 title_label_->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList( |
| 129 ui::ResourceBundle::MediumBoldFont)); | 127 ui::ResourceBundle::MediumBoldFont)); |
| 130 title_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 128 title_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 151 } // namespace | 149 } // namespace |
| 152 | 150 |
| 153 //////////////////////////////////////////////////////////////////////////////// | 151 //////////////////////////////////////////////////////////////////////////////// |
| 154 // Factory function. | 152 // Factory function. |
| 155 | 153 |
| 156 void ShowMultiprofilesSessionAbortedDialog(const std::string& user_email) { | 154 void ShowMultiprofilesSessionAbortedDialog(const std::string& user_email) { |
| 157 MultiprofilesSessionAbortedView::ShowDialog(user_email); | 155 MultiprofilesSessionAbortedView::ShowDialog(user_email); |
| 158 } | 156 } |
| 159 | 157 |
| 160 } // namespace chromeos | 158 } // namespace chromeos |
| OLD | NEW |