| 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/common/ash_constants.h" | 9 #include "ash/common/ash_constants.h" |
| 10 #include "ash/common/shelf/wm_shelf.h" |
| 10 #include "ash/common/wm/window_state.h" | 11 #include "ash/common/wm/window_state.h" |
| 11 #include "ash/common/wm/wm_event.h" | 12 #include "ash/common/wm/wm_event.h" |
| 12 #include "ash/common/wm/wm_screen_util.h" | 13 #include "ash/common/wm/wm_screen_util.h" |
| 13 #include "ash/common/wm_shell.h" | 14 #include "ash/common/wm_shell.h" |
| 14 #include "ash/common/wm_window.h" | 15 #include "ash/common/wm_window.h" |
| 15 #include "ash/root_window_controller.h" | 16 #include "ash/root_window_controller.h" |
| 16 #include "ash/shell.h" | 17 #include "ash/shell.h" |
| 17 #include "ash/wm/window_properties.h" | 18 #include "ash/wm/window_properties.h" |
| 18 #include "ash/wm/window_state_aura.h" | 19 #include "ash/wm/window_state_aura.h" |
| 19 #include "ui/aura/client/aura_constants.h" | 20 #include "ui/aura/client/aura_constants.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 77 |
| 77 bool IsWindowUserPositionable(aura::Window* window) { | 78 bool IsWindowUserPositionable(aura::Window* window) { |
| 78 return GetWindowState(window)->IsUserPositionable(); | 79 return GetWindowState(window)->IsUserPositionable(); |
| 79 } | 80 } |
| 80 | 81 |
| 81 void PinWindow(aura::Window* window, bool trusted) { | 82 void PinWindow(aura::Window* window, bool trusted) { |
| 82 wm::WMEvent event(trusted ? wm::WM_EVENT_TRUSTED_PIN : wm::WM_EVENT_PIN); | 83 wm::WMEvent event(trusted ? wm::WM_EVENT_TRUSTED_PIN : wm::WM_EVENT_PIN); |
| 83 wm::GetWindowState(window)->OnWMEvent(&event); | 84 wm::GetWindowState(window)->OnWMEvent(&event); |
| 84 } | 85 } |
| 85 | 86 |
| 87 void SetAutoHideShelf(aura::Window* window, bool autohide) { |
| 88 wm::GetWindowState(window)->set_autohide_shelf_when_maximized_or_fullscreen( |
| 89 autohide); |
| 90 for (WmWindow* root_window : WmShell::Get()->GetAllRootWindows()) |
| 91 WmShelf::ForWindow(root_window)->UpdateVisibilityState(); |
| 92 } |
| 93 |
| 86 bool MoveWindowToDisplay(aura::Window* window, int64_t display_id) { | 94 bool MoveWindowToDisplay(aura::Window* window, int64_t display_id) { |
| 87 DCHECK(window); | 95 DCHECK(window); |
| 88 WmWindow* root = WmShell::Get()->GetRootWindowForDisplayId(display_id); | 96 WmWindow* root = WmShell::Get()->GetRootWindowForDisplayId(display_id); |
| 89 return root && MoveWindowToRoot(window, root->aura_window()); | 97 return root && MoveWindowToRoot(window, root->aura_window()); |
| 90 } | 98 } |
| 91 | 99 |
| 92 bool MoveWindowToEventRoot(aura::Window* window, const ui::Event& event) { | 100 bool MoveWindowToEventRoot(aura::Window* window, const ui::Event& event) { |
| 93 DCHECK(window); | 101 DCHECK(window); |
| 94 views::View* target = static_cast<views::View*>(event.target()); | 102 views::View* target = static_cast<views::View*>(event.target()); |
| 95 if (!target) | 103 if (!target) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 112 } | 120 } |
| 113 | 121 |
| 114 void SetSnapsChildrenToPhysicalPixelBoundary(aura::Window* container) { | 122 void SetSnapsChildrenToPhysicalPixelBoundary(aura::Window* container) { |
| 115 DCHECK(!container->GetProperty(kSnapChildrenToPixelBoundary)) | 123 DCHECK(!container->GetProperty(kSnapChildrenToPixelBoundary)) |
| 116 << container->GetName(); | 124 << container->GetName(); |
| 117 container->SetProperty(kSnapChildrenToPixelBoundary, true); | 125 container->SetProperty(kSnapChildrenToPixelBoundary, true); |
| 118 } | 126 } |
| 119 | 127 |
| 120 } // namespace wm | 128 } // namespace wm |
| 121 } // namespace ash | 129 } // namespace ash |
| OLD | NEW |