Chromium Code Reviews| 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> | |
| 8 | |
| 7 #include "ash/aura/wm_window_aura.h" | 9 #include "ash/aura/wm_window_aura.h" |
| 10 #include "ash/common/accessibility_delegate.h" | |
| 8 #include "ash/common/shell_window_ids.h" | 11 #include "ash/common/shell_window_ids.h" |
| 12 #include "ash/common/system/tray/system_tray_notifier.h" | |
| 9 #include "ash/common/wm/window_resizer.h" | 13 #include "ash/common/wm/window_resizer.h" |
| 10 #include "ash/common/wm/window_state.h" | 14 #include "ash/common/wm/window_state.h" |
| 11 #include "ash/common/wm/window_state_delegate.h" | 15 #include "ash/common/wm/window_state_delegate.h" |
| 16 #include "ash/common/wm_shell.h" | |
| 12 #include "ash/shell.h" | 17 #include "ash/shell.h" |
| 13 #include "ash/wm/window_state_aura.h" | 18 #include "ash/wm/window_state_aura.h" |
| 14 #include "ash/wm/window_util.h" | 19 #include "ash/wm/window_util.h" |
| 15 #include "base/logging.h" | 20 #include "base/logging.h" |
| 16 #include "base/macros.h" | 21 #include "base/macros.h" |
| 17 #include "base/memory/ptr_util.h" | 22 #include "base/memory/ptr_util.h" |
| 18 #include "base/strings/utf_string_conversions.h" | 23 #include "base/strings/utf_string_conversions.h" |
| 19 #include "base/trace_event/trace_event.h" | 24 #include "base/trace_event/trace_event.h" |
| 20 #include "base/trace_event/trace_event_argument.h" | 25 #include "base/trace_event/trace_event_argument.h" |
| 21 #include "components/exo/surface.h" | 26 #include "components/exo/surface.h" |
| 22 #include "ui/aura/client/aura_constants.h" | 27 #include "ui/aura/client/aura_constants.h" |
| 23 #include "ui/aura/client/cursor_client.h" | 28 #include "ui/aura/client/cursor_client.h" |
| 24 #include "ui/aura/window.h" | 29 #include "ui/aura/window.h" |
| 25 #include "ui/aura/window_event_dispatcher.h" | 30 #include "ui/aura/window_event_dispatcher.h" |
| 26 #include "ui/aura/window_property.h" | 31 #include "ui/aura/window_property.h" |
| 27 #include "ui/aura/window_targeter.h" | 32 #include "ui/aura/window_targeter.h" |
| 28 #include "ui/aura/window_tree_host.h" | 33 #include "ui/aura/window_tree_host.h" |
| 29 #include "ui/base/accelerators/accelerator.h" | 34 #include "ui/base/accelerators/accelerator.h" |
| 30 #include "ui/gfx/path.h" | 35 #include "ui/gfx/path.h" |
| 31 #include "ui/views/widget/widget.h" | 36 #include "ui/views/widget/widget.h" |
| 32 #include "ui/views/widget/widget_observer.h" | 37 #include "ui/views/widget/widget_observer.h" |
| 33 #include "ui/wm/core/coordinate_conversion.h" | 38 #include "ui/wm/core/coordinate_conversion.h" |
| 34 #include "ui/wm/core/shadow.h" | 39 #include "ui/wm/core/shadow.h" |
| 35 #include "ui/wm/core/shadow_controller.h" | 40 #include "ui/wm/core/shadow_controller.h" |
| 36 #include "ui/wm/core/shadow_types.h" | 41 #include "ui/wm/core/shadow_types.h" |
| 37 #include "ui/wm/core/window_util.h" | 42 #include "ui/wm/core/window_util.h" |
| 38 | 43 |
| 44 #if defined(OS_CHROMEOS) | |
| 45 #include "chromeos/audio/chromeos_sounds.h" | |
| 46 #endif | |
| 47 | |
| 39 DECLARE_WINDOW_PROPERTY_TYPE(std::string*) | 48 DECLARE_WINDOW_PROPERTY_TYPE(std::string*) |
| 40 | 49 |
| 41 namespace exo { | 50 namespace exo { |
| 42 namespace { | 51 namespace { |
| 43 | 52 |
| 44 // This is a struct for accelerator keys used to close ShellSurfaces. | 53 // This is a struct for accelerator keys used to close ShellSurfaces. |
| 45 const struct Accelerator { | 54 const struct Accelerator { |
| 46 ui::KeyboardCode keycode; | 55 ui::KeyboardCode keycode; |
| 47 int modifiers; | 56 int modifiers; |
| 48 } kCloseWindowAccelerators[] = { | 57 } kCloseWindowAccelerators[] = { |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 79 void SizeConstraintsChanged() override {} | 88 void SizeConstraintsChanged() override {} |
| 80 | 89 |
| 81 private: | 90 private: |
| 82 views::Widget* const widget_; | 91 views::Widget* const widget_; |
| 83 | 92 |
| 84 DISALLOW_COPY_AND_ASSIGN(CustomFrameView); | 93 DISALLOW_COPY_AND_ASSIGN(CustomFrameView); |
| 85 }; | 94 }; |
| 86 | 95 |
| 87 class CustomWindowTargeter : public aura::WindowTargeter { | 96 class CustomWindowTargeter : public aura::WindowTargeter { |
| 88 public: | 97 public: |
| 89 CustomWindowTargeter() {} | 98 CustomWindowTargeter() : shadow_underlay_(nullptr) {} |
| 90 ~CustomWindowTargeter() override {} | 99 ~CustomWindowTargeter() override {} |
| 91 | 100 |
| 92 // Overridden from aura::WindowTargeter: | 101 // Overridden from aura::WindowTargeter: |
| 93 bool EventLocationInsideBounds(aura::Window* window, | 102 bool EventLocationInsideBounds(aura::Window* window, |
| 94 const ui::LocatedEvent& event) const override { | 103 const ui::LocatedEvent& event) const override { |
| 95 Surface* surface = ShellSurface::GetMainSurface(window); | 104 Surface* surface = ShellSurface::GetMainSurface(window); |
| 96 if (!surface) | 105 if (!surface) |
| 97 return false; | 106 return false; |
| 98 | 107 |
| 99 gfx::Point local_point = event.location(); | 108 gfx::Point local_point = event.location(); |
| 100 if (window->parent()) | 109 |
|
reveman
2016/09/30 05:59:10
where did this check go? can you instead keep this
erosky
2016/09/30 18:38:40
ConvertPointToTarget already does the check, but I
| |
| 101 aura::Window::ConvertPointToTarget(window->parent(), window, | 110 // If the underlay is accepting events, test against it's bounds instead |
| 111 // since it will be larger than (and contain) the surface's bounds. | |
| 112 if (shadow_underlay_ && !shadow_underlay_->ignore_events()) { | |
| 113 aura::Window::ConvertPointToTarget(window->parent(), shadow_underlay_, | |
| 102 &local_point); | 114 &local_point); |
| 115 return gfx::Rect(shadow_underlay_->layer()->size()).Contains(local_point); | |
| 116 } | |
| 117 | |
| 118 aura::Window::ConvertPointToTarget(window->parent(), window, &local_point); | |
| 103 | 119 |
| 104 aura::Window::ConvertPointToTarget(window, surface->window(), &local_point); | 120 aura::Window::ConvertPointToTarget(window, surface->window(), &local_point); |
| 105 return surface->HitTestRect(gfx::Rect(local_point, gfx::Size(1, 1))); | 121 return surface->HitTestRect(gfx::Rect(local_point, gfx::Size(1, 1))); |
| 106 } | 122 } |
| 107 | 123 |
| 124 ui::EventTarget* FindTargetForEvent(ui::EventTarget* root, | |
|
reveman
2016/09/30 05:59:10
Why do we need to override this? What would it tak
erosky
2016/09/30 18:38:40
The default implementation clips the event at the
| |
| 125 ui::Event* event) override { | |
| 126 aura::Window* window = static_cast<aura::Window*>(root); | |
| 127 Surface* surface = ShellSurface::GetMainSurface(window); | |
| 128 | |
| 129 // Send events which are outside of the surface's bounds to the underlay. | |
| 130 if (surface && event->IsLocatedEvent() && shadow_underlay_ && | |
| 131 !shadow_underlay_->ignore_events()) { | |
| 132 gfx::Point local_point = event->AsLocatedEvent()->location(); | |
| 133 aura::Window::ConvertPointToTarget(window, surface->window(), | |
| 134 &local_point); | |
| 135 if (!surface->HitTestRect(gfx::Rect(local_point, gfx::Size(1, 1)))) | |
| 136 return shadow_underlay_; | |
| 137 } | |
| 138 return aura::WindowTargeter::FindTargetForEvent(root, event); | |
| 139 } | |
| 140 | |
| 141 void set_shadow_underlay(aura::Window* shadow_underlay) { | |
| 142 shadow_underlay_ = shadow_underlay; | |
| 143 } | |
| 144 | |
| 108 private: | 145 private: |
| 146 aura::Window* shadow_underlay_; | |
|
reveman
2016/09/30 05:59:10
Instead of tracking this state here and having to
erosky
2016/09/30 18:38:40
It can't get out of sync because there is a 1-to-1
| |
| 147 | |
| 109 DISALLOW_COPY_AND_ASSIGN(CustomWindowTargeter); | 148 DISALLOW_COPY_AND_ASSIGN(CustomWindowTargeter); |
| 110 }; | 149 }; |
| 111 | 150 |
| 112 // Handles a user's fullscreen request (Shift+F4/F4). | 151 // Handles a user's fullscreen request (Shift+F4/F4). |
| 113 class CustomWindowStateDelegate : public ash::wm::WindowStateDelegate, | 152 class CustomWindowStateDelegate : public ash::wm::WindowStateDelegate, |
| 114 public views::WidgetObserver { | 153 public views::WidgetObserver { |
| 115 public: | 154 public: |
| 116 explicit CustomWindowStateDelegate(views::Widget* widget) : widget_(widget) { | 155 explicit CustomWindowStateDelegate(views::Widget* widget) : widget_(widget) { |
| 117 widget_->AddObserver(this); | 156 widget_->AddObserver(this); |
| 118 } | 157 } |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 294 } | 333 } |
| 295 WMHelper::GetInstance()->RemoveActivationObserver(this); | 334 WMHelper::GetInstance()->RemoveActivationObserver(this); |
| 296 if (parent_) | 335 if (parent_) |
| 297 parent_->RemoveObserver(this); | 336 parent_->RemoveObserver(this); |
| 298 if (surface_) { | 337 if (surface_) { |
| 299 if (scale_ != 1.0) | 338 if (scale_ != 1.0) |
| 300 surface_->window()->SetTransform(gfx::Transform()); | 339 surface_->window()->SetTransform(gfx::Transform()); |
| 301 surface_->SetSurfaceDelegate(nullptr); | 340 surface_->SetSurfaceDelegate(nullptr); |
| 302 surface_->RemoveSurfaceObserver(this); | 341 surface_->RemoveSurfaceObserver(this); |
| 303 } | 342 } |
| 343 ash::WmShell::Get()->system_tray_notifier()->RemoveAccessibilityObserver( | |
| 344 this); | |
| 304 } | 345 } |
| 305 | 346 |
| 306 void ShellSurface::AcknowledgeConfigure(uint32_t serial) { | 347 void ShellSurface::AcknowledgeConfigure(uint32_t serial) { |
| 307 TRACE_EVENT1("exo", "ShellSurface::AcknowledgeConfigure", "serial", serial); | 348 TRACE_EVENT1("exo", "ShellSurface::AcknowledgeConfigure", "serial", serial); |
| 308 | 349 |
| 309 // Apply all configs that are older or equal to |serial|. The result is that | 350 // Apply all configs that are older or equal to |serial|. The result is that |
| 310 // the origin of the main surface will move and the resize direction will | 351 // the origin of the main surface will move and the resize direction will |
| 311 // change to reflect the acknowledgement of configure request with |serial| | 352 // change to reflect the acknowledgement of configure request with |serial| |
| 312 // at the next call to Commit(). | 353 // at the next call to Commit(). |
| 313 while (!pending_configs_.empty()) { | 354 while (!pending_configs_.empty()) { |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 719 // views::Views overrides: | 760 // views::Views overrides: |
| 720 | 761 |
| 721 gfx::Size ShellSurface::GetPreferredSize() const { | 762 gfx::Size ShellSurface::GetPreferredSize() const { |
| 722 if (!geometry_.IsEmpty()) | 763 if (!geometry_.IsEmpty()) |
| 723 return geometry_.size(); | 764 return geometry_.size(); |
| 724 | 765 |
| 725 return surface_ ? surface_->window()->layer()->size() : gfx::Size(); | 766 return surface_ ? surface_->window()->layer()->size() : gfx::Size(); |
| 726 } | 767 } |
| 727 | 768 |
| 728 //////////////////////////////////////////////////////////////////////////////// | 769 //////////////////////////////////////////////////////////////////////////////// |
| 770 // ash::AccessibilityObserver overrides: | |
| 771 | |
| 772 void ShellSurface::OnAccessibilityModeChanged( | |
| 773 ash::AccessibilityNotificationVisibility) { | |
| 774 UpdateShadow(); | |
| 775 } | |
| 776 | |
| 777 //////////////////////////////////////////////////////////////////////////////// | |
| 729 // ash::wm::WindowStateObserver overrides: | 778 // ash::wm::WindowStateObserver overrides: |
| 730 | 779 |
| 731 void ShellSurface::OnPreWindowStateTypeChange( | 780 void ShellSurface::OnPreWindowStateTypeChange( |
| 732 ash::wm::WindowState* window_state, | 781 ash::wm::WindowState* window_state, |
| 733 ash::wm::WindowStateType old_type) { | 782 ash::wm::WindowStateType old_type) { |
| 734 ash::wm::WindowStateType new_type = window_state->GetStateType(); | 783 ash::wm::WindowStateType new_type = window_state->GetStateType(); |
| 735 if (ash::wm::IsMaximizedOrFullscreenOrPinnedWindowStateType(old_type) || | 784 if (ash::wm::IsMaximizedOrFullscreenOrPinnedWindowStateType(old_type) || |
| 736 ash::wm::IsMaximizedOrFullscreenOrPinnedWindowStateType(new_type)) { | 785 ash::wm::IsMaximizedOrFullscreenOrPinnedWindowStateType(new_type)) { |
| 737 // When transitioning in/out of maximized or fullscreen mode we need to | 786 // When transitioning in/out of maximized or fullscreen mode we need to |
| 738 // make sure we have a configure callback before we allow the default | 787 // make sure we have a configure callback before we allow the default |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 814 void ShellSurface::OnWindowActivated( | 863 void ShellSurface::OnWindowActivated( |
| 815 aura::Window* gained_active, | 864 aura::Window* gained_active, |
| 816 aura::Window* lost_active) { | 865 aura::Window* lost_active) { |
| 817 if (!widget_) | 866 if (!widget_) |
| 818 return; | 867 return; |
| 819 | 868 |
| 820 if (gained_active == widget_->GetNativeWindow() || | 869 if (gained_active == widget_->GetNativeWindow() || |
| 821 lost_active == widget_->GetNativeWindow()) { | 870 lost_active == widget_->GetNativeWindow()) { |
| 822 DCHECK(activatable_); | 871 DCHECK(activatable_); |
| 823 Configure(); | 872 Configure(); |
| 873 UpdateShadow(); | |
| 824 } | 874 } |
| 825 } | 875 } |
| 826 | 876 |
| 827 //////////////////////////////////////////////////////////////////////////////// | 877 //////////////////////////////////////////////////////////////////////////////// |
| 828 // ui::EventHandler overrides: | 878 // ui::EventHandler overrides: |
| 829 | 879 |
| 880 void ShellSurface::OnEvent(ui::Event* event) { | |
| 881 // If the event is targeted at the underlay, it means the user has made an | |
| 882 // interaction that is outside the surface's bounds and we want to capture | |
| 883 // it (usually when in spoken_feedback mode). Handle the event (to prevent | |
|
reveman
2016/09/30 05:59:10
nit: s/spoken_feedback/spoken feedback/
erosky
2016/09/30 18:38:40
Done.
| |
| 884 // behind-windows from receiving it) and play an earcon to notify the user. | |
| 885 if (event->IsLocatedEvent() && event->target() == shadow_underlay_ && | |
| 886 shadow_underlay_ && !shadow_underlay_->ignore_events()) { | |
| 887 #if defined(OS_CHROMEOS) | |
| 888 const ui::EventType kEarconEventTypes[] = { | |
|
reveman
2016/09/30 05:59:10
nit: are these elements sorted in a way that I'm f
erosky
2016/09/30 18:38:40
Done.
| |
| 889 ui::ET_TOUCH_PRESSED, ui::ET_POINTER_DOWN, | |
| 890 ui::ET_POINTER_WHEEL_CHANGED, ui::ET_SCROLL, | |
| 891 ui::ET_SCROLL_FLING_START, ui::ET_GESTURE_BEGIN, | |
| 892 ui::ET_MOUSE_PRESSED, ui::ET_MOUSEWHEEL}; | |
| 893 bool is_earcon_event_type = | |
| 894 std::find(std::begin(kEarconEventTypes), std::end(kEarconEventTypes), | |
| 895 event->type()) != std::end(kEarconEventTypes); | |
| 896 if (is_earcon_event_type) | |
| 897 ash::WmShell::Get()->accessibility_delegate()->PlayEarcon( | |
| 898 chromeos::SOUND_VOLUME_ADJUST); | |
| 899 #endif | |
| 900 event->SetHandled(); | |
| 901 return; | |
| 902 } | |
| 903 views::View::OnEvent(event); | |
| 904 } | |
| 905 | |
| 830 void ShellSurface::OnKeyEvent(ui::KeyEvent* event) { | 906 void ShellSurface::OnKeyEvent(ui::KeyEvent* event) { |
| 831 if (!resizer_) { | 907 if (!resizer_) { |
| 832 views::View::OnKeyEvent(event); | 908 views::View::OnKeyEvent(event); |
| 833 return; | 909 return; |
| 834 } | 910 } |
| 835 | 911 |
| 836 if (event->type() == ui::ET_KEY_PRESSED && | 912 if (event->type() == ui::ET_KEY_PRESSED && |
| 837 event->key_code() == ui::VKEY_ESCAPE) { | 913 event->key_code() == ui::VKEY_ESCAPE) { |
| 838 EndDrag(true /* revert */); | 914 EndDrag(true /* revert */); |
| 839 } | 915 } |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 975 for (const auto& entry : kCloseWindowAccelerators) { | 1051 for (const auto& entry : kCloseWindowAccelerators) { |
| 976 focus_manager->RegisterAccelerator( | 1052 focus_manager->RegisterAccelerator( |
| 977 ui::Accelerator(entry.keycode, entry.modifiers), | 1053 ui::Accelerator(entry.keycode, entry.modifiers), |
| 978 ui::AcceleratorManager::kNormalPriority, this); | 1054 ui::AcceleratorManager::kNormalPriority, this); |
| 979 } | 1055 } |
| 980 | 1056 |
| 981 // Set delegate for handling of fullscreening. | 1057 // Set delegate for handling of fullscreening. |
| 982 window_state->SetDelegate(std::unique_ptr<ash::wm::WindowStateDelegate>( | 1058 window_state->SetDelegate(std::unique_ptr<ash::wm::WindowStateDelegate>( |
| 983 new CustomWindowStateDelegate(widget_))); | 1059 new CustomWindowStateDelegate(widget_))); |
| 984 | 1060 |
| 1061 // Receive accessibility changes to update shadow underlay. | |
| 1062 ash::WmShell::Get()->system_tray_notifier()->AddAccessibilityObserver(this); | |
| 1063 | |
| 985 // Show widget next time Commit() is called. | 1064 // Show widget next time Commit() is called. |
| 986 pending_show_widget_ = true; | 1065 pending_show_widget_ = true; |
| 987 } | 1066 } |
| 988 | 1067 |
| 989 void ShellSurface::Configure() { | 1068 void ShellSurface::Configure() { |
| 990 DCHECK(widget_); | 1069 DCHECK(widget_); |
| 991 | 1070 |
| 992 // Delay configure callback if |scoped_configure_| is set. | 1071 // Delay configure callback if |scoped_configure_| is set. |
| 993 if (scoped_configure_) { | 1072 if (scoped_configure_) { |
| 994 scoped_configure_->set_needs_configure(); | 1073 scoped_configure_->set_needs_configure(); |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1234 // TODO(oshima): Adjust the coordinates from client screen to | 1313 // TODO(oshima): Adjust the coordinates from client screen to |
| 1235 // chromeos screen when multi displays are supported. | 1314 // chromeos screen when multi displays are supported. |
| 1236 gfx::Point origin = window->bounds().origin(); | 1315 gfx::Point origin = window->bounds().origin(); |
| 1237 gfx::Point shadow_origin = shadow_content_bounds_.origin(); | 1316 gfx::Point shadow_origin = shadow_content_bounds_.origin(); |
| 1238 shadow_origin -= origin.OffsetFromOrigin(); | 1317 shadow_origin -= origin.OffsetFromOrigin(); |
| 1239 gfx::Rect shadow_bounds(shadow_origin, shadow_content_bounds_.size()); | 1318 gfx::Rect shadow_bounds(shadow_origin, shadow_content_bounds_.size()); |
| 1240 | 1319 |
| 1241 // Always create and show the underlay, even in maximized/fullscreen. | 1320 // Always create and show the underlay, even in maximized/fullscreen. |
| 1242 if (!shadow_underlay_) { | 1321 if (!shadow_underlay_) { |
| 1243 shadow_underlay_ = new aura::Window(nullptr); | 1322 shadow_underlay_ = new aura::Window(nullptr); |
| 1323 shadow_underlay_->SetTargetHandler(this); | |
|
reveman
2016/09/30 05:59:10
Can we use a different aura::WindowDelegate for th
erosky
2016/09/30 18:38:40
Done.
| |
| 1244 DCHECK(shadow_underlay_->owned_by_parent()); | 1324 DCHECK(shadow_underlay_->owned_by_parent()); |
| 1245 shadow_underlay_->set_ignore_events(true); | |
| 1246 // Ensure the background area inside the shadow is solid black. | 1325 // Ensure the background area inside the shadow is solid black. |
| 1247 // Clients that provide translucent contents should not be using | 1326 // Clients that provide translucent contents should not be using |
| 1248 // rectangular shadows as this method requires opaque contents to | 1327 // rectangular shadows as this method requires opaque contents to |
| 1249 // cast a shadow that represent it correctly. | 1328 // cast a shadow that represent it correctly. |
| 1250 shadow_underlay_->Init(ui::LAYER_SOLID_COLOR); | 1329 shadow_underlay_->Init(ui::LAYER_SOLID_COLOR); |
| 1251 shadow_underlay_->layer()->SetColor(SK_ColorBLACK); | 1330 shadow_underlay_->layer()->SetColor(SK_ColorBLACK); |
| 1252 DCHECK(shadow_underlay_->layer()->fills_bounds_opaquely()); | 1331 DCHECK(shadow_underlay_->layer()->fills_bounds_opaquely()); |
| 1253 window->AddChild(shadow_underlay_); | 1332 window->AddChild(shadow_underlay_); |
| 1254 window->StackChildAtBottom(shadow_underlay_); | 1333 window->StackChildAtBottom(shadow_underlay_); |
| 1334 static_cast<CustomWindowTargeter*>( | |
| 1335 static_cast<ui::EventTarget*>(window)->GetEventTargeter()) | |
| 1336 ->set_shadow_underlay(shadow_underlay_); | |
| 1255 } | 1337 } |
| 1256 | 1338 |
| 1339 bool underlay_capture_events = ash::WmShell::Get() | |
| 1340 ->accessibility_delegate() | |
| 1341 ->IsSpokenFeedbackEnabled() && | |
| 1342 widget_->IsActive(); | |
| 1343 shadow_underlay_->set_ignore_events(!underlay_capture_events); | |
| 1344 | |
| 1257 float shadow_underlay_opacity = rectangular_shadow_background_opacity_; | 1345 float shadow_underlay_opacity = rectangular_shadow_background_opacity_; |
| 1258 // Put the black background layer behind the window if | 1346 // Put the black background layer behind the window if |
| 1259 // 1) the window is in immersive fullscreen. | 1347 // 1) the window is in immersive fullscreen or is active with |
| 1348 // spoken feedback enabled. | |
| 1260 // 2) the window can control the bounds of the window in fullscreen ( | 1349 // 2) the window can control the bounds of the window in fullscreen ( |
| 1261 // thus the background can be visible). | 1350 // thus the background can be visible). |
| 1262 // 3) the window has no transform (the transformed background may | 1351 // 3) the window has no transform (the transformed background may |
| 1263 // not cover the entire background, e.g. overview mode). | 1352 // not cover the entire background, e.g. overview mode). |
| 1264 if (widget_->IsFullscreen() && | 1353 if ((widget_->IsFullscreen() || underlay_capture_events) && |
| 1265 ash::wm::GetWindowState(window)->allow_set_bounds_in_maximized() && | 1354 ash::wm::GetWindowState(window)->allow_set_bounds_in_maximized() && |
| 1266 window->layer()->transform().IsIdentity()) { | 1355 window->layer()->GetTargetTransform().IsIdentity()) { |
| 1267 gfx::Point origin; | 1356 gfx::Point origin; |
| 1268 origin -= window->bounds().origin().OffsetFromOrigin(); | 1357 origin -= window->bounds().origin().OffsetFromOrigin(); |
| 1269 shadow_bounds.set_origin(origin); | 1358 shadow_bounds.set_origin(origin); |
| 1270 shadow_bounds.set_size(window->parent()->bounds().size()); | 1359 shadow_bounds.set_size(window->parent()->bounds().size()); |
| 1271 shadow_underlay_opacity = 1.0f; | 1360 shadow_underlay_opacity = 1.0f; |
| 1272 } | 1361 } |
| 1273 | 1362 |
| 1274 shadow_underlay_->SetBounds(shadow_bounds); | 1363 shadow_underlay_->SetBounds(shadow_bounds); |
| 1275 | 1364 |
| 1276 // TODO(oshima): Setting to the same value should be no-op. | 1365 // TODO(oshima): Setting to the same value should be no-op. |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 1295 shadow_overlay_->layer()->Add(shadow->layer()); | 1384 shadow_overlay_->layer()->Add(shadow->layer()); |
| 1296 window->AddChild(shadow_overlay_); | 1385 window->AddChild(shadow_overlay_); |
| 1297 shadow_overlay_->Show(); | 1386 shadow_overlay_->Show(); |
| 1298 } | 1387 } |
| 1299 shadow_overlay_->SetBounds(shadow_bounds); | 1388 shadow_overlay_->SetBounds(shadow_bounds); |
| 1300 shadow->SetContentBounds(gfx::Rect(shadow_bounds.size())); | 1389 shadow->SetContentBounds(gfx::Rect(shadow_bounds.size())); |
| 1301 } | 1390 } |
| 1302 } | 1391 } |
| 1303 | 1392 |
| 1304 } // namespace exo | 1393 } // namespace exo |
| OLD | NEW |