| 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/shelf/wm_shelf.h" |
| 11 #include "ash/common/wm/window_state.h" | 11 #include "ash/common/wm/window_state.h" |
| 12 #include "ash/common/wm/wm_event.h" | 12 #include "ash/common/wm/wm_event.h" |
| 13 #include "ash/common/wm/wm_screen_util.h" | 13 #include "ash/common/wm/wm_screen_util.h" |
| 14 #include "ash/common/wm_shell.h" | 14 #include "ash/common/wm_shell.h" |
| 15 #include "ash/common/wm_window.h" | 15 #include "ash/common/wm_window.h" |
| 16 #include "ash/root_window_controller.h" | 16 #include "ash/root_window_controller.h" |
| 17 #include "ash/shell.h" | 17 #include "ash/shell.h" |
| 18 #include "ash/wm/window_properties.h" | 18 #include "ash/wm/window_properties.h" |
| 19 #include "ash/wm/window_state_aura.h" | 19 #include "ash/wm/window_state_aura.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" |
| 22 #include "ui/aura/client/focus_client.h" |
| 21 #include "ui/aura/window.h" | 23 #include "ui/aura/window.h" |
| 22 #include "ui/aura/window_delegate.h" | 24 #include "ui/aura/window_delegate.h" |
| 23 #include "ui/aura/window_event_dispatcher.h" | 25 #include "ui/aura/window_event_dispatcher.h" |
| 24 #include "ui/compositor/dip_util.h" | 26 #include "ui/compositor/dip_util.h" |
| 25 #include "ui/gfx/geometry/rect.h" | 27 #include "ui/gfx/geometry/rect.h" |
| 26 #include "ui/gfx/geometry/size.h" | 28 #include "ui/gfx/geometry/size.h" |
| 27 #include "ui/views/view.h" | 29 #include "ui/views/view.h" |
| 28 #include "ui/views/widget/widget.h" | 30 #include "ui/views/widget/widget.h" |
| 29 #include "ui/wm/core/window_util.h" | 31 #include "ui/wm/core/window_util.h" |
| 30 #include "ui/wm/public/activation_client.h" | 32 #include "ui/wm/public/activation_client.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 } | 70 } |
| 69 | 71 |
| 70 aura::Window* GetActivatableWindow(aura::Window* window) { | 72 aura::Window* GetActivatableWindow(aura::Window* window) { |
| 71 return ::wm::GetActivatableWindow(window); | 73 return ::wm::GetActivatableWindow(window); |
| 72 } | 74 } |
| 73 | 75 |
| 74 bool CanActivateWindow(aura::Window* window) { | 76 bool CanActivateWindow(aura::Window* window) { |
| 75 return ::wm::CanActivateWindow(window); | 77 return ::wm::CanActivateWindow(window); |
| 76 } | 78 } |
| 77 | 79 |
| 80 aura::Window* GetFocusedWindow() { |
| 81 return aura::client::GetFocusClient(Shell::GetPrimaryRootWindow()) |
| 82 ->GetFocusedWindow(); |
| 83 } |
| 84 |
| 85 aura::Window* GetCaptureWindow() { |
| 86 return aura::client::GetCaptureWindow(Shell::GetPrimaryRootWindow()); |
| 87 } |
| 88 |
| 78 bool IsWindowUserPositionable(aura::Window* window) { | 89 bool IsWindowUserPositionable(aura::Window* window) { |
| 79 return GetWindowState(window)->IsUserPositionable(); | 90 return GetWindowState(window)->IsUserPositionable(); |
| 80 } | 91 } |
| 81 | 92 |
| 82 void PinWindow(aura::Window* window, bool trusted) { | 93 void PinWindow(aura::Window* window, bool trusted) { |
| 83 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); |
| 84 wm::GetWindowState(window)->OnWMEvent(&event); | 95 wm::GetWindowState(window)->OnWMEvent(&event); |
| 85 } | 96 } |
| 86 | 97 |
| 87 void SetAutoHideShelf(aura::Window* window, bool autohide) { | 98 void SetAutoHideShelf(aura::Window* window, bool autohide) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 } | 131 } |
| 121 | 132 |
| 122 void SetSnapsChildrenToPhysicalPixelBoundary(aura::Window* container) { | 133 void SetSnapsChildrenToPhysicalPixelBoundary(aura::Window* container) { |
| 123 DCHECK(!container->GetProperty(kSnapChildrenToPixelBoundary)) | 134 DCHECK(!container->GetProperty(kSnapChildrenToPixelBoundary)) |
| 124 << container->GetName(); | 135 << container->GetName(); |
| 125 container->SetProperty(kSnapChildrenToPixelBoundary, true); | 136 container->SetProperty(kSnapChildrenToPixelBoundary, true); |
| 126 } | 137 } |
| 127 | 138 |
| 128 } // namespace wm | 139 } // namespace wm |
| 129 } // namespace ash | 140 } // namespace ash |
| OLD | NEW |