Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/aura/wm_window_aura.h" | 5 #include "ash/wm/aura/wm_window_aura.h" |
| 6 | 6 |
| 7 #include "ash/screen_util.h" | 7 #include "ash/screen_util.h" |
| 8 #include "ash/wm/aura/wm_globals_aura.h" | |
| 8 #include "ash/wm/aura/wm_root_window_controller_aura.h" | 9 #include "ash/wm/aura/wm_root_window_controller_aura.h" |
| 9 #include "ash/wm/common/wm_window_observer.h" | 10 #include "ash/wm/common/wm_window_observer.h" |
| 10 #include "ash/wm/common/wm_window_property.h" | 11 #include "ash/wm/common/wm_window_property.h" |
| 11 #include "ash/wm/window_animations.h" | 12 #include "ash/wm/window_animations.h" |
| 12 #include "ash/wm/window_properties.h" | 13 #include "ash/wm/window_properties.h" |
| 13 #include "ash/wm/window_state.h" | 14 #include "ash/wm/window_state.h" |
| 14 #include "ash/wm/window_state_aura.h" | 15 #include "ash/wm/window_state_aura.h" |
| 15 #include "ash/wm/window_util.h" | 16 #include "ash/wm/window_util.h" |
| 16 #include "ui/aura/client/aura_constants.h" | 17 #include "ui/aura/client/aura_constants.h" |
| 17 #include "ui/aura/layout_manager.h" | 18 #include "ui/aura/layout_manager.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 86 | 87 |
| 87 const WmWindow* WmWindowAura::GetRootWindow() const { | 88 const WmWindow* WmWindowAura::GetRootWindow() const { |
| 88 return Get(window_->GetRootWindow()); | 89 return Get(window_->GetRootWindow()); |
| 89 } | 90 } |
| 90 | 91 |
| 91 WmRootWindowController* WmWindowAura::GetRootWindowController() { | 92 WmRootWindowController* WmWindowAura::GetRootWindowController() { |
| 92 aura::Window* root = window_->GetRootWindow(); | 93 aura::Window* root = window_->GetRootWindow(); |
| 93 return root ? WmRootWindowControllerAura::Get(root) : nullptr; | 94 return root ? WmRootWindowControllerAura::Get(root) : nullptr; |
| 94 } | 95 } |
| 95 | 96 |
| 97 WmGlobals* WmWindowAura::GetGlobals() const { | |
| 98 return WmGlobalsAura::Get(); | |
| 99 } | |
| 100 | |
| 96 int WmWindowAura::GetShellWindowId() { | 101 int WmWindowAura::GetShellWindowId() { |
| 97 return window_->id(); | 102 return window_->id(); |
| 98 } | 103 } |
| 99 | 104 |
| 100 ui::wm::WindowType WmWindowAura::GetType() const { | 105 ui::wm::WindowType WmWindowAura::GetType() const { |
| 101 return window_->type(); | 106 return window_->type(); |
| 102 } | 107 } |
| 103 | 108 |
| 104 ui::Layer* WmWindowAura::GetLayer() { | 109 ui::Layer* WmWindowAura::GetLayer() { |
| 105 return window_->layer(); | 110 return window_->layer(); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 170 return window_->GetProperty(kSnapChildrenToPixelBoundary); | 175 return window_->GetProperty(kSnapChildrenToPixelBoundary); |
| 171 | 176 |
| 172 case WmWindowProperty::ALWAYS_ON_TOP: | 177 case WmWindowProperty::ALWAYS_ON_TOP: |
| 173 return window_->GetProperty(aura::client::kAlwaysOnTopKey); | 178 return window_->GetProperty(aura::client::kAlwaysOnTopKey); |
| 174 } | 179 } |
| 175 | 180 |
| 176 NOTREACHED(); | 181 NOTREACHED(); |
| 177 return false; | 182 return false; |
| 178 } | 183 } |
| 179 | 184 |
| 180 WindowState* WmWindowAura::GetWindowState() { | 185 const WindowState* WmWindowAura::GetWindowState() const { |
| 181 return ash::wm::GetWindowState(window_); | 186 return ash::wm::GetWindowState(window_); |
| 182 } | 187 } |
| 183 | 188 |
| 184 WmWindow* WmWindowAura::GetToplevelWindow() { | 189 WmWindow* WmWindowAura::GetToplevelWindow() { |
| 185 return Get(window_->GetToplevelWindow()); | 190 return Get(window_->GetToplevelWindow()); |
| 186 } | 191 } |
| 187 | 192 |
| 188 WmWindow* WmWindowAura::GetParent() { | 193 WmWindow* WmWindowAura::GetParent() { |
| 189 return Get(window_->parent()); | 194 return Get(window_->parent()); |
| 190 } | 195 } |
| 191 | 196 |
| 192 WmWindow* WmWindowAura::GetTransientParent() { | 197 WmWindow* WmWindowAura::GetTransientParent() { |
| 193 return Get(::wm::GetTransientParent(window_)); | 198 return Get(::wm::GetTransientParent(window_)); |
| 194 } | 199 } |
| 195 | 200 |
| 201 std::vector<WmWindow*> WmWindowAura::GetTransientChildren() { | |
| 202 const std::vector<aura::Window*> aura_windows( | |
| 203 ::wm::GetTransientChildren(window_)); | |
| 204 std::vector<WmWindow*> wm_windows(aura_windows.size()); | |
| 205 for (size_t i = 0; i < aura_windows.size(); ++i) | |
| 206 wm_windows[i] = Get(aura_windows[i]); | |
|
oshima
2016/04/18 18:09:17
Looks like we're converting aura window -> wm wind
| |
| 207 return wm_windows; | |
| 208 } | |
| 209 | |
| 196 void WmWindowAura::SetBounds(const gfx::Rect& bounds) { | 210 void WmWindowAura::SetBounds(const gfx::Rect& bounds) { |
| 197 window_->SetBounds(bounds); | 211 window_->SetBounds(bounds); |
| 198 } | 212 } |
| 199 | 213 |
| 214 void WmWindowAura::SetBoundsWithTransitionDelay(const gfx::Rect& bounds, | |
| 215 base::TimeDelta delta) { | |
| 216 if (::wm::WindowAnimationsDisabled(window_)) { | |
| 217 window_->SetBounds(bounds); | |
| 218 return; | |
| 219 } | |
| 220 | |
| 221 ui::ScopedLayerAnimationSettings settings(window_->layer()->GetAnimator()); | |
| 222 settings.SetTransitionDuration(delta); | |
| 223 window_->SetBounds(bounds); | |
| 224 } | |
| 225 | |
| 200 void WmWindowAura::SetBoundsDirect(const gfx::Rect& bounds) { | 226 void WmWindowAura::SetBoundsDirect(const gfx::Rect& bounds) { |
| 201 BoundsSetter().SetBounds(window_, bounds); | 227 BoundsSetter().SetBounds(window_, bounds); |
| 202 SnapWindowToPixelBoundary(window_); | 228 SnapWindowToPixelBoundary(window_); |
| 203 } | 229 } |
| 204 | 230 |
| 205 void WmWindowAura::SetBoundsDirectAnimated(const gfx::Rect& bounds) { | 231 void WmWindowAura::SetBoundsDirectAnimated(const gfx::Rect& bounds) { |
| 206 const int kBoundsChangeSlideDurationMs = 120; | 232 const int kBoundsChangeSlideDurationMs = 120; |
| 207 | 233 |
| 208 ui::Layer* layer = window_->layer(); | 234 ui::Layer* layer = window_->layer(); |
| 209 ui::ScopedLayerAnimationSettings slide_settings(layer->GetAnimator()); | 235 ui::ScopedLayerAnimationSettings slide_settings(layer->GetAnimator()); |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 441 FOR_EACH_OBSERVER(WmWindowObserver, observers_, | 467 FOR_EACH_OBSERVER(WmWindowObserver, observers_, |
| 442 OnWindowBoundsChanged(this, old_bounds, new_bounds)); | 468 OnWindowBoundsChanged(this, old_bounds, new_bounds)); |
| 443 } | 469 } |
| 444 | 470 |
| 445 void WmWindowAura::OnWindowDestroying(aura::Window* window) { | 471 void WmWindowAura::OnWindowDestroying(aura::Window* window) { |
| 446 FOR_EACH_OBSERVER(WmWindowObserver, observers_, OnWindowDestroying(this)); | 472 FOR_EACH_OBSERVER(WmWindowObserver, observers_, OnWindowDestroying(this)); |
| 447 } | 473 } |
| 448 | 474 |
| 449 } // namespace wm | 475 } // namespace wm |
| 450 } // namespace ash | 476 } // namespace ash |
| OLD | NEW |