Chromium Code Reviews| Index: chrome/browser/ui/views/importer/import_lock_dialog_view.cc |
| diff --git a/chrome/browser/ui/views/importer/import_lock_dialog_view.cc b/chrome/browser/ui/views/importer/import_lock_dialog_view.cc |
| index 061fceb48ea3a6ac4271d93e229ccfcf97703c79..52125c60482830bab4430f83c91d86739b64f3fb 100644 |
| --- a/chrome/browser/ui/views/importer/import_lock_dialog_view.cc |
| +++ b/chrome/browser/ui/views/importer/import_lock_dialog_view.cc |
| @@ -30,13 +30,30 @@ void ShowImportLockDialog(gfx::NativeWindow parent, |
| content::RecordAction(UserMetricsAction("ImportLockDialogView_Shown")); |
| } |
| +void HideImportLockDialog() { |
| + ImportLockDialogView::Hide(); |
| +} |
| + |
| } // namespace importer |
| +// For storing widget ptr on creation of dialog widget |
| +// using method CreateDialogWidget. |
| +namespace { |
| +static views::Widget* g_widget = nullptr; |
| +} |
| + |
| +// static |
| +void ImportLockDialogView::Hide() { |
| + if (g_widget) |
| + g_widget->Close(); |
|
Ilya Sherman
2017/03/30 22:14:32
Should you set g_widget to nullptr here?
nikhil.sahni
2017/03/31 15:21:25
Done.
|
| +} |
| + |
| // static |
| void ImportLockDialogView::Show(gfx::NativeWindow parent, |
| const base::Callback<void(bool)>& callback) { |
| - views::DialogDelegate::CreateDialogWidget( |
| - new ImportLockDialogView(callback), NULL, NULL)->Show(); |
| + g_widget = views::DialogDelegate::CreateDialogWidget( |
| + new ImportLockDialogView(callback), NULL, NULL); |
| + g_widget->Show(); |
| } |
| ImportLockDialogView::ImportLockDialogView( |
| @@ -80,6 +97,7 @@ base::string16 ImportLockDialogView::GetWindowTitle() const { |
| bool ImportLockDialogView::Accept() { |
| base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, |
| base::Bind(callback_, true)); |
| + g_widget = nullptr; |
|
Ilya Sherman
2017/03/30 22:14:32
What about if the user cancels the dialog instead?
nikhil.sahni
2017/03/31 15:21:25
In case of CANCEL even the IMPORT Dialog gets clos
Ilya Sherman
2017/04/04 05:39:52
Yes, I think implementing ImportLockDialogView::On
nikhil.sahni
2017/04/04 09:21:40
Done.
|
| return true; |
| } |