Chromium Code Reviews| Index: components/exo/shell_surface.cc |
| diff --git a/components/exo/shell_surface.cc b/components/exo/shell_surface.cc |
| index 00a36dafe34afe065a4edb1d2dce8b858e4dc83e..4ac81ab980bd8f07234ed5cea16ebc801cf14560 100644 |
| --- a/components/exo/shell_surface.cc |
| +++ b/components/exo/shell_surface.cc |
| @@ -496,9 +496,28 @@ void ShellSurface::SetSystemModal(bool system_modal) { |
| << "Only a window in SystemModalContainer can change the modality"; |
| return; |
| } |
| + |
| + if (system_modal == system_modal_) |
| + return; |
| + |
| + system_modal_ = system_modal; |
| + |
| + if (!widget_) { |
|
reveman
2017/03/11 00:45:08
nit: I don't think we should have this warning. Se
khmel
2017/03/11 01:33:32
Nice, done
|
| + DLOG(WARNING) << "Skip setting system modal state to " << system_modal_ |
| + << " because window is not ready yet."; |
| + return; |
| + } |
| + |
| + UpdateSystemModal(); |
| +} |
| + |
| +void ShellSurface::UpdateSystemModal() { |
| + DCHECK(widget_); |
| + DCHECK(!system_modal_ || |
| + container_ == ash::kShellWindowId_SystemModalContainer); |
|
reveman
2017/03/11 00:45:09
nit: just DCHECK_EQ(container_, ash::kShellWindowI
khmel
2017/03/11 01:33:32
Done.
|
| widget_->GetNativeWindow()->SetProperty( |
| aura::client::kModalKey, |
| - system_modal ? ui::MODAL_TYPE_SYSTEM : ui::MODAL_TYPE_NONE); |
| + system_modal_ ? ui::MODAL_TYPE_SYSTEM : ui::MODAL_TYPE_NONE); |
| } |
| // static |
| @@ -766,6 +785,7 @@ void ShellSurface::OnSurfaceCommit() { |
| DCHECK(!widget_->IsVisible()); |
| pending_show_widget_ = false; |
| widget_->Show(); |
| + UpdateSystemModal(); |
| } |
| } |
| } |