| 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/ui/ash/multi_user/multi_user_warning_dialog.h" | 5 #include "chrome/browser/ui/ash/multi_user/multi_user_warning_dialog.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/base/l10n/l10n_util.h" | 9 #include "ui/base/l10n/l10n_util.h" |
| 10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 const int kPaddingToMessage = 30; | 25 const int kPaddingToMessage = 30; |
| 26 const int kPaddingToCheckBox = 50; | 26 const int kPaddingToCheckBox = 50; |
| 27 const int kInset = 40; | 27 const int kInset = 40; |
| 28 const int kTopInset = 10; | 28 const int kTopInset = 10; |
| 29 | 29 |
| 30 //////////////////////////////////////////////////////////////////////////////// | 30 //////////////////////////////////////////////////////////////////////////////// |
| 31 // Dialog for multi-profiles teleport warning. | 31 // Dialog for multi-profiles teleport warning. |
| 32 class TeleportWarningView : public views::DialogDelegateView { | 32 class TeleportWarningView : public views::DialogDelegateView { |
| 33 public: | 33 public: |
| 34 TeleportWarningView(base::Callback<void(bool)> on_accept); | 34 explicit TeleportWarningView(const base::Callback<void(bool)>& on_accept); |
| 35 virtual ~TeleportWarningView(); | 35 virtual ~TeleportWarningView(); |
| 36 | 36 |
| 37 static void ShowDialog(const base::Callback<void(bool)> on_accept); | 37 static void ShowDialog(const base::Callback<void(bool)>& on_accept); |
| 38 | 38 |
| 39 // views::DialogDelegate overrides. | 39 // views::DialogDelegate overrides. |
| 40 virtual bool Accept() OVERRIDE; | 40 virtual bool Accept() OVERRIDE; |
| 41 | 41 |
| 42 // views::WidgetDelegate overrides. | 42 // views::WidgetDelegate overrides. |
| 43 virtual ui::ModalType GetModalType() const OVERRIDE; | 43 virtual ui::ModalType GetModalType() const OVERRIDE; |
| 44 | 44 |
| 45 // views::View overrides. | 45 // views::View overrides. |
| 46 virtual gfx::Size GetPreferredSize() const OVERRIDE; | 46 virtual gfx::Size GetPreferredSize() const OVERRIDE; |
| 47 | 47 |
| 48 private: | 48 private: |
| 49 void InitDialog(); | 49 void InitDialog(); |
| 50 | 50 |
| 51 scoped_ptr<views::Checkbox> no_show_checkbox_; | 51 scoped_ptr<views::Checkbox> no_show_checkbox_; |
| 52 const base::Callback<void(bool)> on_accept_; | 52 const base::Callback<void(bool)> on_accept_; |
| 53 | 53 |
| 54 DISALLOW_COPY_AND_ASSIGN(TeleportWarningView); | 54 DISALLOW_COPY_AND_ASSIGN(TeleportWarningView); |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 //////////////////////////////////////////////////////////////////////////////// | 57 //////////////////////////////////////////////////////////////////////////////// |
| 58 // TeleportWarningView implementation. | 58 // TeleportWarningView implementation. |
| 59 | 59 |
| 60 TeleportWarningView::TeleportWarningView( | 60 TeleportWarningView::TeleportWarningView( |
| 61 const base::Callback<void(bool)> on_accept) | 61 const base::Callback<void(bool)>& on_accept) |
| 62 : on_accept_(on_accept) { | 62 : on_accept_(on_accept) { |
| 63 } | 63 } |
| 64 | 64 |
| 65 TeleportWarningView::~TeleportWarningView() { | 65 TeleportWarningView::~TeleportWarningView() { |
| 66 } | 66 } |
| 67 | 67 |
| 68 // static | 68 // static |
| 69 void TeleportWarningView::ShowDialog( | 69 void TeleportWarningView::ShowDialog( |
| 70 const base::Callback<void(bool)> on_accept) { | 70 const base::Callback<void(bool)>& on_accept) { |
| 71 TeleportWarningView* dialog_view = | 71 TeleportWarningView* dialog_view = |
| 72 new TeleportWarningView(on_accept); | 72 new TeleportWarningView(on_accept); |
| 73 views::DialogDelegate::CreateDialogWidget( | 73 views::DialogDelegate::CreateDialogWidget( |
| 74 dialog_view, ash::Shell::GetTargetRootWindow(), NULL); | 74 dialog_view, ash::Shell::GetTargetRootWindow(), NULL); |
| 75 dialog_view->InitDialog(); | 75 dialog_view->InitDialog(); |
| 76 views::Widget* widget = dialog_view->GetWidget(); | 76 views::Widget* widget = dialog_view->GetWidget(); |
| 77 DCHECK(widget); | 77 DCHECK(widget); |
| 78 widget->Show(); | 78 widget->Show(); |
| 79 } | 79 } |
| 80 | 80 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 SetLayoutManager(grid_layout); | 149 SetLayoutManager(grid_layout); |
| 150 Layout(); | 150 Layout(); |
| 151 } | 151 } |
| 152 | 152 |
| 153 } // namespace | 153 } // namespace |
| 154 | 154 |
| 155 //////////////////////////////////////////////////////////////////////////////// | 155 //////////////////////////////////////////////////////////////////////////////// |
| 156 // Factory function. | 156 // Factory function. |
| 157 | 157 |
| 158 void ShowMultiprofilesWarningDialog( | 158 void ShowMultiprofilesWarningDialog( |
| 159 const base::Callback<void(bool)> on_accept) { | 159 const base::Callback<void(bool)>& on_accept) { |
| 160 TeleportWarningView::ShowDialog(on_accept); | 160 TeleportWarningView::ShowDialog(on_accept); |
| 161 } | 161 } |
| 162 | 162 |
| 163 } // namespace chromeos | 163 } // namespace chromeos |
| OLD | NEW |