OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/exo/shell_surface.h" | 5 #include "components/exo/shell_surface.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ash/aura/wm_window_aura.h" | 9 #include "ash/aura/wm_window_aura.h" |
10 #include "ash/common/shelf/wm_shelf.h" | 10 #include "ash/common/shelf/wm_shelf.h" |
(...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1013 // region is non-empty. See OnCommitSurface() for more details. | 1013 // region is non-empty. See OnCommitSurface() for more details. |
1014 if (container_ == ash::kShellWindowId_SystemModalContainer) | 1014 if (container_ == ash::kShellWindowId_SystemModalContainer) |
1015 activatable &= !surface_->GetHitTestBounds().IsEmpty(); | 1015 activatable &= !surface_->GetHitTestBounds().IsEmpty(); |
1016 params.activatable = activatable ? views::Widget::InitParams::ACTIVATABLE_YES | 1016 params.activatable = activatable ? views::Widget::InitParams::ACTIVATABLE_YES |
1017 : views::Widget::InitParams::ACTIVATABLE_NO; | 1017 : views::Widget::InitParams::ACTIVATABLE_NO; |
1018 | 1018 |
1019 // Note: NativeWidget owns this widget. | 1019 // Note: NativeWidget owns this widget. |
1020 widget_ = new ShellSurfaceWidget(this); | 1020 widget_ = new ShellSurfaceWidget(this); |
1021 widget_->Init(params); | 1021 widget_->Init(params); |
1022 | 1022 |
| 1023 // Make root view of ShellSurfaceWidget non-focusable. If it's focusable, |
| 1024 // accessibility service will put focus on it and consumes key events. |
| 1025 views::View* root_view = widget_->GetRootView(); |
| 1026 DCHECK(root_view); |
| 1027 root_view->SetFocusBehavior(views::View::FocusBehavior::NEVER); |
| 1028 |
1023 aura::Window* window = widget_->GetNativeWindow(); | 1029 aura::Window* window = widget_->GetNativeWindow(); |
1024 window->SetName("ExoShellSurface"); | 1030 window->SetName("ExoShellSurface"); |
1025 window->AddChild(surface_->window()); | 1031 window->AddChild(surface_->window()); |
1026 window->SetEventTargeter(base::WrapUnique(new CustomWindowTargeter(widget_))); | 1032 window->SetEventTargeter(base::WrapUnique(new CustomWindowTargeter(widget_))); |
1027 SetApplicationId(window, application_id_); | 1033 SetApplicationId(window, application_id_); |
1028 SetMainSurface(window, surface_); | 1034 SetMainSurface(window, surface_); |
1029 | 1035 |
1030 // Start tracking changes to window bounds and window state. | 1036 // Start tracking changes to window bounds and window state. |
1031 window->AddObserver(this); | 1037 window->AddObserver(this); |
1032 ash::wm::WindowState* window_state = ash::wm::GetWindowState(window); | 1038 ash::wm::WindowState* window_state = ash::wm::GetWindowState(window); |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1402 shadow_overlay_->layer()->Add(shadow->layer()); | 1408 shadow_overlay_->layer()->Add(shadow->layer()); |
1403 window->AddChild(shadow_overlay_); | 1409 window->AddChild(shadow_overlay_); |
1404 shadow_overlay_->Show(); | 1410 shadow_overlay_->Show(); |
1405 } | 1411 } |
1406 shadow_overlay_->SetBounds(shadow_bounds); | 1412 shadow_overlay_->SetBounds(shadow_bounds); |
1407 shadow->SetContentBounds(gfx::Rect(shadow_bounds.size())); | 1413 shadow->SetContentBounds(gfx::Rect(shadow_bounds.size())); |
1408 } | 1414 } |
1409 } | 1415 } |
1410 | 1416 |
1411 } // namespace exo | 1417 } // namespace exo |
OLD | NEW |