Chromium Code Reviews| Index: components/exo/shell_surface.cc |
| diff --git a/components/exo/shell_surface.cc b/components/exo/shell_surface.cc |
| index cc30d37ae67c6ef06338893007b4157f16ee0a2b..54ee34186fa2c75ad0313ea655262f1539f16bcc 100644 |
| --- a/components/exo/shell_surface.cc |
| +++ b/components/exo/shell_surface.cc |
| @@ -377,6 +377,23 @@ void ShellSurface::SetTitle(const base::string16& title) { |
| widget_->UpdateWindowTitle(); |
| } |
| +void ShellSurface::SetSystemModal(bool system_modal) { |
| + // System modal container is used by clients to implement client side |
| + // managed system modal dialogs using a single ShellSurface instance. |
| + // Hit-test region will be non-empty when at least one dialog exists on |
| + // the client side. Here we detect the transition between no client side |
| + // dialog and at least one dialog so activatable state is properly |
| + // updated. |
| + if (container_ != ash::kShellWindowId_SystemModalContainer) { |
| + LOG(ERROR) |
| + << "Only a window in SystemModalContainer can change the modality"; |
| + return; |
| + } |
| + widget_->GetNativeWindow()->SetProperty( |
| + aura::client::kModalKey, |
| + system_modal ? ui::MODAL_TYPE_SYSTEM : ui::MODAL_TYPE_NONE); |
| +} |
| + |
| // static |
| void ShellSurface::SetApplicationId(aura::Window* window, |
| std::string* application_id) { |
| @@ -504,12 +521,10 @@ void ShellSurface::OnSurfaceCommit() { |
| gfx::Point surface_origin = GetSurfaceOrigin(); |
| - // System modal container is used by clients to implement client side |
| - // managed system modal dialogs using a single ShellSurface instance. |
| - // Hit-test region will be non-empty when at least one dialog exists on |
| - // the client side. Here we detect the transition between no client side |
| - // dialog and at least one dialog so activatable state is properly |
| - // updated. |
| + // System modal container is used by clients to implement overlay |
| + // windows using a single ShellSurface instance. If hit-test |
| + // region is empty, then it is non interactive window and won't be |
| + // activated. |
| if (container_ == ash::kShellWindowId_SystemModalContainer) { |
|
oshima
2016/06/27 19:25:54
IIRC, you said you may need to undo this change (c
reveman
2016/06/27 20:45:00
If it's possible to move this logic to SetSystemMo
oshima
2016/06/29 15:01:22
There seems to be other windows that are opened in
|
| gfx::Rect hit_test_bounds = |
| surface_->GetHitTestBounds() + surface_origin.OffsetFromOrigin(); |
| @@ -518,10 +533,6 @@ void ShellSurface::OnSurfaceCommit() { |
| bool activatable = activatable_ && !hit_test_bounds.IsEmpty(); |
| if (activatable != CanActivate()) { |
| set_can_activate(activatable); |
| - widget_->GetNativeWindow()->SetProperty( |
| - aura::client::kModalKey, |
| - activatable ? ui::MODAL_TYPE_SYSTEM : ui::MODAL_TYPE_NONE); |
| - |
| // Activate or deactivate window if activation state changed. |
| if (activatable) |
| wm::ActivateWindow(widget_->GetNativeWindow()); |