| Index: ash/common/focus_cycler.cc
|
| diff --git a/ash/focus_cycler.cc b/ash/common/focus_cycler.cc
|
| similarity index 69%
|
| rename from ash/focus_cycler.cc
|
| rename to ash/common/focus_cycler.cc
|
| index 41fd63812142566010b65d1ad05e8733122541a2..8eb40f090135458571649be0fd5b5ea501364759 100644
|
| --- a/ash/focus_cycler.cc
|
| +++ b/ash/common/focus_cycler.cc
|
| @@ -2,15 +2,12 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "ash/focus_cycler.h"
|
| +#include "ash/common/focus_cycler.h"
|
|
|
| -#include "ash/aura/wm_window_aura.h"
|
| #include "ash/common/wm/mru_window_tracker.h"
|
| #include "ash/common/wm/window_state.h"
|
| -#include "ash/shell.h"
|
| -#include "ash/wm/window_state_aura.h"
|
| -#include "ash/wm/window_util.h"
|
| -#include "ui/aura/window.h"
|
| +#include "ash/common/wm_shell.h"
|
| +#include "ash/common/wm_window.h"
|
| #include "ui/views/accessible_pane_view.h"
|
| #include "ui/views/focus/focus_search.h"
|
| #include "ui/views/widget/widget.h"
|
| @@ -21,17 +18,14 @@ namespace ash {
|
| namespace {
|
|
|
| bool HasFocusableWindow() {
|
| - return !ash::Shell::GetInstance()->
|
| - mru_window_tracker()->BuildMruWindowList().empty();
|
| + return !WmShell::Get()->GetMruWindowTracker()->BuildMruWindowList().empty();
|
| }
|
|
|
| } // namespace
|
|
|
| -FocusCycler::FocusCycler() : widget_activating_(NULL) {
|
| -}
|
| +FocusCycler::FocusCycler() : widget_activating_(nullptr) {}
|
|
|
| -FocusCycler::~FocusCycler() {
|
| -}
|
| +FocusCycler::~FocusCycler() {}
|
|
|
| void FocusCycler::AddWidget(views::Widget* widget) {
|
| widgets_.push_back(widget);
|
| @@ -44,14 +38,15 @@ void FocusCycler::RemoveWidget(views::Widget* widget) {
|
| }
|
|
|
| void FocusCycler::RotateFocus(Direction direction) {
|
| - aura::Window* window = ash::wm::GetActiveWindow();
|
| + WmWindow* window = WmShell::Get()->GetActiveWindow();
|
| if (window) {
|
| - views::Widget* widget = views::Widget::GetWidgetForNativeWindow(window);
|
| + views::Widget* widget = window->GetInternalWidget();
|
| // First try to rotate focus within the active widget. If that succeeds,
|
| // we're done.
|
| - if (widget && widget->GetFocusManager()->RotatePaneFocus(
|
| - direction == BACKWARD ?
|
| - views::FocusManager::kBackward : views::FocusManager::kForward,
|
| + if (widget &&
|
| + widget->GetFocusManager()->RotatePaneFocus(
|
| + direction == BACKWARD ? views::FocusManager::kBackward
|
| + : views::FocusManager::kForward,
|
| views::FocusManager::kNoWrap)) {
|
| return;
|
| }
|
| @@ -85,21 +80,20 @@ void FocusCycler::RotateFocus(Direction direction) {
|
| if (index == browser_index) {
|
| // Activate the most recently active browser window.
|
| MruWindowTracker::WindowList mru_windows(
|
| - Shell::GetInstance()->mru_window_tracker()->BuildMruWindowList());
|
| + WmShell::Get()->GetMruWindowTracker()->BuildMruWindowList());
|
| if (mru_windows.empty())
|
| break;
|
| WmWindow* window = mru_windows.front();
|
| window->GetWindowState()->Activate();
|
| - views::Widget* widget = views::Widget::GetWidgetForNativeWindow(
|
| - WmWindowAura::GetAuraWindow(window));
|
| + views::Widget* widget = window->GetInternalWidget();
|
| if (!widget)
|
| break;
|
| views::FocusManager* focus_manager = widget->GetFocusManager();
|
| focus_manager->ClearFocus();
|
| - focus_manager->RotatePaneFocus(
|
| - direction == BACKWARD ?
|
| - views::FocusManager::kBackward : views::FocusManager::kForward,
|
| - views::FocusManager::kWrap);
|
| + focus_manager->RotatePaneFocus(direction == BACKWARD
|
| + ? views::FocusManager::kBackward
|
| + : views::FocusManager::kForward,
|
| + views::FocusManager::kWrap);
|
| break;
|
| } else {
|
| if (FocusWidget(widgets_[index]))
|
|
|