| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/wm/window_util.h" | 5 #include "ash/wm/window_util.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "ash/ash_constants.h" | 9 #include "ash/ash_constants.h" |
| 10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
| 11 #include "ash/shelf/wm_shelf.h" | 11 #include "ash/shelf/wm_shelf.h" |
| 12 #include "ash/shell.h" | 12 #include "ash/shell.h" |
| 13 #include "ash/shell_port.h" |
| 13 #include "ash/wm/window_properties.h" | 14 #include "ash/wm/window_properties.h" |
| 14 #include "ash/wm/window_state.h" | 15 #include "ash/wm/window_state.h" |
| 15 #include "ash/wm/window_state_aura.h" | 16 #include "ash/wm/window_state_aura.h" |
| 16 #include "ash/wm/wm_event.h" | 17 #include "ash/wm/wm_event.h" |
| 17 #include "ash/wm/wm_screen_util.h" | 18 #include "ash/wm/wm_screen_util.h" |
| 18 #include "ash/wm_shell.h" | |
| 19 #include "ash/wm_window.h" | 19 #include "ash/wm_window.h" |
| 20 #include "ui/aura/client/aura_constants.h" | 20 #include "ui/aura/client/aura_constants.h" |
| 21 #include "ui/aura/client/capture_client.h" | 21 #include "ui/aura/client/capture_client.h" |
| 22 #include "ui/aura/client/focus_client.h" | 22 #include "ui/aura/client/focus_client.h" |
| 23 #include "ui/aura/window.h" | 23 #include "ui/aura/window.h" |
| 24 #include "ui/aura/window_delegate.h" | 24 #include "ui/aura/window_delegate.h" |
| 25 #include "ui/aura/window_event_dispatcher.h" | 25 #include "ui/aura/window_event_dispatcher.h" |
| 26 #include "ui/compositor/dip_util.h" | 26 #include "ui/compositor/dip_util.h" |
| 27 #include "ui/gfx/geometry/rect.h" | 27 #include "ui/gfx/geometry/rect.h" |
| 28 #include "ui/gfx/geometry/size.h" | 28 #include "ui/gfx/geometry/size.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 } | 91 } |
| 92 | 92 |
| 93 void PinWindow(aura::Window* window, bool trusted) { | 93 void PinWindow(aura::Window* window, bool trusted) { |
| 94 wm::WMEvent event(trusted ? wm::WM_EVENT_TRUSTED_PIN : wm::WM_EVENT_PIN); | 94 wm::WMEvent event(trusted ? wm::WM_EVENT_TRUSTED_PIN : wm::WM_EVENT_PIN); |
| 95 wm::GetWindowState(window)->OnWMEvent(&event); | 95 wm::GetWindowState(window)->OnWMEvent(&event); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void SetAutoHideShelf(aura::Window* window, bool autohide) { | 98 void SetAutoHideShelf(aura::Window* window, bool autohide) { |
| 99 wm::GetWindowState(window)->set_autohide_shelf_when_maximized_or_fullscreen( | 99 wm::GetWindowState(window)->set_autohide_shelf_when_maximized_or_fullscreen( |
| 100 autohide); | 100 autohide); |
| 101 for (WmWindow* root_window : WmShell::Get()->GetAllRootWindows()) | 101 for (WmWindow* root_window : ShellPort::Get()->GetAllRootWindows()) |
| 102 WmShelf::ForWindow(root_window)->UpdateVisibilityState(); | 102 WmShelf::ForWindow(root_window)->UpdateVisibilityState(); |
| 103 } | 103 } |
| 104 | 104 |
| 105 bool MoveWindowToDisplay(aura::Window* window, int64_t display_id) { | 105 bool MoveWindowToDisplay(aura::Window* window, int64_t display_id) { |
| 106 DCHECK(window); | 106 DCHECK(window); |
| 107 WmWindow* root = WmShell::Get()->GetRootWindowForDisplayId(display_id); | 107 WmWindow* root = ShellPort::Get()->GetRootWindowForDisplayId(display_id); |
| 108 return root && MoveWindowToRoot(window, root->aura_window()); | 108 return root && MoveWindowToRoot(window, root->aura_window()); |
| 109 } | 109 } |
| 110 | 110 |
| 111 bool MoveWindowToEventRoot(aura::Window* window, const ui::Event& event) { | 111 bool MoveWindowToEventRoot(aura::Window* window, const ui::Event& event) { |
| 112 DCHECK(window); | 112 DCHECK(window); |
| 113 views::View* target = static_cast<views::View*>(event.target()); | 113 views::View* target = static_cast<views::View*>(event.target()); |
| 114 if (!target) | 114 if (!target) |
| 115 return false; | 115 return false; |
| 116 aura::Window* root = target->GetWidget()->GetNativeView()->GetRootWindow(); | 116 aura::Window* root = target->GetWidget()->GetNativeView()->GetRootWindow(); |
| 117 return root && MoveWindowToRoot(window, root); | 117 return root && MoveWindowToRoot(window, root); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 131 } | 131 } |
| 132 | 132 |
| 133 void SetSnapsChildrenToPhysicalPixelBoundary(aura::Window* container) { | 133 void SetSnapsChildrenToPhysicalPixelBoundary(aura::Window* container) { |
| 134 DCHECK(!container->GetProperty(kSnapChildrenToPixelBoundary)) | 134 DCHECK(!container->GetProperty(kSnapChildrenToPixelBoundary)) |
| 135 << container->GetName(); | 135 << container->GetName(); |
| 136 container->SetProperty(kSnapChildrenToPixelBoundary, true); | 136 container->SetProperty(kSnapChildrenToPixelBoundary, true); |
| 137 } | 137 } |
| 138 | 138 |
| 139 } // namespace wm | 139 } // namespace wm |
| 140 } // namespace ash | 140 } // namespace ash |
| OLD | NEW |