| 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/shelf/shelf_util.h" | 8 #include "ash/shelf/shelf_util.h" |
| 9 #include "ash/wm/aura/aura_layout_manager_adapter.h" | 9 #include "ash/wm/aura/aura_layout_manager_adapter.h" |
| 10 #include "ash/wm/aura/wm_globals_aura.h" | 10 #include "ash/wm/aura/wm_globals_aura.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 69 |
| 70 WmWindowAura::WmWindowAura(aura::Window* window) | 70 WmWindowAura::WmWindowAura(aura::Window* window) |
| 71 : window_(window), | 71 : window_(window), |
| 72 // Mirrors that of aura::Window. | 72 // Mirrors that of aura::Window. |
| 73 observers_(base::ObserverList<WmWindowObserver>::NOTIFY_EXISTING_ONLY) { | 73 observers_(base::ObserverList<WmWindowObserver>::NOTIFY_EXISTING_ONLY) { |
| 74 window_->AddObserver(this); | 74 window_->AddObserver(this); |
| 75 window_->SetProperty(kWmWindowKey, this); | 75 window_->SetProperty(kWmWindowKey, this); |
| 76 } | 76 } |
| 77 | 77 |
| 78 // static | 78 // static |
| 79 WmWindow* WmWindow::Get(views::Widget* widget) { | |
| 80 return WmWindowAura::Get(widget->GetNativeWindow()); | |
| 81 } | |
| 82 | |
| 83 // static | |
| 84 WmWindow* WmWindowAura::Get(aura::Window* window) { | 79 WmWindow* WmWindowAura::Get(aura::Window* window) { |
| 85 if (!window) | 80 if (!window) |
| 86 return nullptr; | 81 return nullptr; |
| 87 | 82 |
| 88 WmWindow* wm_window = window->GetProperty(kWmWindowKey); | 83 WmWindow* wm_window = window->GetProperty(kWmWindowKey); |
| 89 if (wm_window) | 84 if (wm_window) |
| 90 return wm_window; | 85 return wm_window; |
| 91 // WmWindowAura is owned by the aura::Window. | 86 // WmWindowAura is owned by the aura::Window. |
| 92 return new WmWindowAura(window); | 87 return new WmWindowAura(window); |
| 93 } | 88 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 110 const WmWindow* WmWindowAura::GetRootWindow() const { | 105 const WmWindow* WmWindowAura::GetRootWindow() const { |
| 111 return Get(window_->GetRootWindow()); | 106 return Get(window_->GetRootWindow()); |
| 112 } | 107 } |
| 113 | 108 |
| 114 WmRootWindowController* WmWindowAura::GetRootWindowController() { | 109 WmRootWindowController* WmWindowAura::GetRootWindowController() { |
| 115 aura::Window* root = window_->GetRootWindow(); | 110 aura::Window* root = window_->GetRootWindow(); |
| 116 return root ? WmRootWindowControllerAura::Get(root) : nullptr; | 111 return root ? WmRootWindowControllerAura::Get(root) : nullptr; |
| 117 } | 112 } |
| 118 | 113 |
| 119 WmGlobals* WmWindowAura::GetGlobals() const { | 114 WmGlobals* WmWindowAura::GetGlobals() const { |
| 120 return WmGlobalsAura::Get(); | 115 return WmGlobals::Get(); |
| 121 } | 116 } |
| 122 | 117 |
| 123 void WmWindowAura::SetShellWindowId(int id) { | 118 void WmWindowAura::SetShellWindowId(int id) { |
| 124 window_->set_id(id); | 119 window_->set_id(id); |
| 125 } | 120 } |
| 126 | 121 |
| 127 int WmWindowAura::GetShellWindowId() const { | 122 int WmWindowAura::GetShellWindowId() const { |
| 128 return window_->id(); | 123 return window_->id(); |
| 129 } | 124 } |
| 130 | 125 |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 } | 556 } |
| 562 | 557 |
| 563 void WmWindowAura::OnWindowVisibilityChanging(aura::Window* window, | 558 void WmWindowAura::OnWindowVisibilityChanging(aura::Window* window, |
| 564 bool visible) { | 559 bool visible) { |
| 565 FOR_EACH_OBSERVER(WmWindowObserver, observers_, | 560 FOR_EACH_OBSERVER(WmWindowObserver, observers_, |
| 566 OnWindowVisibilityChanging(this, visible)); | 561 OnWindowVisibilityChanging(this, visible)); |
| 567 } | 562 } |
| 568 | 563 |
| 569 } // namespace wm | 564 } // namespace wm |
| 570 } // namespace ash | 565 } // namespace ash |
| OLD | NEW |