| Index: ash/wm/mru_window_tracker.cc
|
| diff --git a/ash/wm/mru_window_tracker.cc b/ash/wm/mru_window_tracker.cc
|
| index 07d87c4f7ecc3018702a6d6821bda662c93ad860..4e611d784c599df5beb4fbb7678256d1b106044a 100644
|
| --- a/ash/wm/mru_window_tracker.cc
|
| +++ b/ash/wm/mru_window_tracker.cc
|
| @@ -13,28 +13,28 @@
|
| #include "ash/wm/switchable_windows.h"
|
| #include "ash/wm/window_state.h"
|
| #include "ash/wm/window_util.h"
|
| -#include "ash/wm_window.h"
|
| #include "base/bind.h"
|
| #include "ui/aura/window.h"
|
| +#include "ui/wm/core/window_util.h"
|
| #include "ui/wm/public/activation_client.h"
|
|
|
| namespace ash {
|
|
|
| namespace {
|
|
|
| -using CanActivateWindowPredicate = base::Callback<bool(WmWindow*)>;
|
| +using CanActivateWindowPredicate = base::Callback<bool(aura::Window*)>;
|
|
|
| -bool CallCanActivate(WmWindow* window) {
|
| - return window->CanActivate();
|
| +bool CallCanActivate(aura::Window* window) {
|
| + return ::wm::CanActivateWindow(window);
|
| }
|
|
|
| // Adds the windows that can be cycled through for the specified window id to
|
| // |windows|.
|
| -void AddTrackedWindows(WmWindow* root,
|
| +void AddTrackedWindows(aura::Window* root,
|
| int container_id,
|
| MruWindowTracker::WindowList* windows) {
|
| - WmWindow* container = root->GetChildByShellWindowId(container_id);
|
| - const MruWindowTracker::WindowList children(container->GetChildren());
|
| + aura::Window* container = root->GetChildById(container_id);
|
| + const MruWindowTracker::WindowList children(container->children());
|
| windows->insert(windows->end(), children.begin(), children.end());
|
| }
|
|
|
| @@ -43,12 +43,12 @@ void AddTrackedWindows(WmWindow* root,
|
| // It uses the given |should_include_window_predicate| to determine whether to
|
| // include a window in the returned list or not.
|
| MruWindowTracker::WindowList BuildWindowListInternal(
|
| - const std::list<WmWindow*>* mru_windows,
|
| + const std::list<aura::Window*>* mru_windows,
|
| const CanActivateWindowPredicate& should_include_window_predicate) {
|
| MruWindowTracker::WindowList windows;
|
| aura::Window* active_root = Shell::GetRootWindowForNewWindows();
|
| - for (WmWindow* window : ShellPort::Get()->GetAllRootWindows()) {
|
| - if (window->aura_window() == active_root)
|
| + for (auto* window : Shell::GetAllRootWindows()) {
|
| + if (window == active_root)
|
| continue;
|
| for (size_t i = 0; i < wm::kSwitchableWindowContainerIdsLength; ++i)
|
| AddTrackedWindows(window, wm::kSwitchableWindowContainerIds[i], &windows);
|
| @@ -57,12 +57,12 @@ MruWindowTracker::WindowList BuildWindowListInternal(
|
| // Add windows in the active root windows last so that the topmost window
|
| // in the active root window becomes the front of the list.
|
| for (size_t i = 0; i < wm::kSwitchableWindowContainerIdsLength; ++i) {
|
| - AddTrackedWindows(WmWindow::Get(active_root),
|
| - wm::kSwitchableWindowContainerIds[i], &windows);
|
| + AddTrackedWindows(active_root, wm::kSwitchableWindowContainerIds[i],
|
| + &windows);
|
| }
|
|
|
| // Removes unfocusable windows.
|
| - std::vector<WmWindow*>::iterator itr = windows.begin();
|
| + MruWindowTracker::WindowList::iterator itr = windows.begin();
|
| while (itr != windows.end()) {
|
| if (!should_include_window_predicate.Run(*itr))
|
| itr = windows.erase(itr);
|
| @@ -77,8 +77,7 @@ MruWindowTracker::WindowList BuildWindowListInternal(
|
| for (auto ix = mru_windows->rbegin(); ix != mru_windows->rend(); ++ix) {
|
| // Exclude windows in non-switchable containers and those which cannot
|
| // be activated.
|
| - if (((*ix)->GetParent() &&
|
| - !wm::IsSwitchableContainer((*ix)->GetParent()->aura_window())) ||
|
| + if (((*ix)->parent() && !wm::IsSwitchableContainer((*ix)->parent())) ||
|
| !should_include_window_predicate.Run(*ix)) {
|
| continue;
|
| }
|
| @@ -109,8 +108,8 @@ MruWindowTracker::MruWindowTracker() : ignore_window_activations_(false) {
|
|
|
| MruWindowTracker::~MruWindowTracker() {
|
| Shell::Get()->activation_client()->RemoveObserver(this);
|
| - for (WmWindow* window : mru_windows_)
|
| - window->aura_window()->RemoveObserver(this);
|
| + for (auto* window : mru_windows_)
|
| + window->RemoveObserver(this);
|
| }
|
|
|
| MruWindowTracker::WindowList MruWindowTracker::BuildMruWindowList() const {
|
| @@ -129,21 +128,21 @@ void MruWindowTracker::SetIgnoreActivations(bool ignore) {
|
| // If no longer ignoring window activations, move currently active window
|
| // to front.
|
| if (!ignore)
|
| - SetActiveWindow(WmWindow::Get(wm::GetActiveWindow()));
|
| + SetActiveWindow(wm::GetActiveWindow());
|
| }
|
|
|
| //////////////////////////////////////////////////////////////////////////////
|
| // MruWindowTracker, private:
|
|
|
| -void MruWindowTracker::SetActiveWindow(WmWindow* active_window) {
|
| +void MruWindowTracker::SetActiveWindow(aura::Window* active_window) {
|
| if (!active_window)
|
| return;
|
|
|
| - std::list<WmWindow*>::iterator iter =
|
| + std::list<aura::Window*>::iterator iter =
|
| std::find(mru_windows_.begin(), mru_windows_.end(), active_window);
|
| // Observe all newly tracked windows.
|
| if (iter == mru_windows_.end())
|
| - active_window->aura_window()->AddObserver(this);
|
| + active_window->AddObserver(this);
|
| else
|
| mru_windows_.erase(iter);
|
| mru_windows_.push_front(active_window);
|
| @@ -153,14 +152,14 @@ void MruWindowTracker::OnWindowActivated(ActivationReason reason,
|
| aura::Window* gained_active,
|
| aura::Window* lost_active) {
|
| if (!ignore_window_activations_)
|
| - SetActiveWindow(WmWindow::Get(gained_active));
|
| + SetActiveWindow(gained_active);
|
| }
|
|
|
| void MruWindowTracker::OnWindowDestroyed(aura::Window* window) {
|
| // It's possible for OnWindowActivated() to be called after
|
| // OnWindowDestroying(). This means we need to override OnWindowDestroyed()
|
| // else we may end up with a deleted window in |mru_windows_|.
|
| - mru_windows_.remove(WmWindow::Get(window));
|
| + mru_windows_.remove(window);
|
| window->RemoveObserver(this);
|
| }
|
|
|
|
|