Index: ash/wm/window_cycle_list.cc |
diff --git a/ash/wm/window_cycle_list.cc b/ash/wm/window_cycle_list.cc |
index fe1e701b2299965a276203a240f3cb9e8e16de5f..1f7474cfe3506a68aa7ebf2f3e399ea7fe7b27e5 100644 |
--- a/ash/wm/window_cycle_list.cc |
+++ b/ash/wm/window_cycle_list.cc |
@@ -11,7 +11,10 @@ |
#include "ash/root_window_controller.h" |
#include "ash/shell.h" |
#include "ash/wm/mru_window_tracker.h" |
+#include "ash/wm/window_mirror_view.h" |
#include "ash/wm/window_state.h" |
+#include "ash/wm/window_state_aura.h" |
+#include "ash/wm/window_util.h" |
#include "ash/wm_window.h" |
#include "base/command_line.h" |
#include "ui/accessibility/ax_node_data.h" |
@@ -60,17 +63,17 @@ class LayerFillBackgroundPainter : public views::Background { |
} // namespace |
-// This view represents a single WmWindow by displaying a title and a thumbnail |
-// of the window's contents. |
+// This view represents a single aura::Window by displaying a title and a |
+// thumbnail of the window's contents. |
class WindowPreviewView : public views::View, public aura::WindowObserver { |
public: |
- explicit WindowPreviewView(WmWindow* window) |
+ explicit WindowPreviewView(aura::Window* window) |
: window_title_(new views::Label), |
preview_background_(new views::View), |
- mirror_view_(window->CreateViewWithRecreatedLayers().release()), |
+ mirror_view_(new wm::WindowMirrorView(window)), |
window_observer_(this) { |
- window_observer_.Add(window->aura_window()); |
- window_title_->SetText(window->aura_window()->GetTitle()); |
+ window_observer_.Add(window); |
+ window_title_->SetText(window->GetTitle()); |
window_title_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
window_title_->SetEnabledColor(SK_ColorWHITE); |
window_title_->SetAutoColorReadabilityEnabled(false); |
@@ -235,7 +238,7 @@ class WindowCycleView : public views::WidgetDelegateView { |
mirror_container_->SetPaintToLayer(); |
mirror_container_->layer()->SetFillsBoundsOpaquely(false); |
- for (WmWindow* window : windows) { |
+ for (auto* window : windows) { |
// |mirror_container_| owns |view|. |
views::View* view = new WindowPreviewView(window); |
window_view_map_[window] = view; |
@@ -259,7 +262,7 @@ class WindowCycleView : public views::WidgetDelegateView { |
~WindowCycleView() override {} |
- void SetTargetWindow(WmWindow* target) { |
+ void SetTargetWindow(aura::Window* target) { |
target_window_ = target; |
if (GetWidget()) { |
Layout(); |
@@ -268,8 +271,8 @@ class WindowCycleView : public views::WidgetDelegateView { |
} |
} |
- void HandleWindowDestruction(WmWindow* destroying_window, |
- WmWindow* new_target) { |
+ void HandleWindowDestruction(aura::Window* destroying_window, |
+ aura::Window* new_target) { |
auto view_iter = window_view_map_.find(destroying_window); |
views::View* preview = view_iter->second; |
views::View* parent = preview->parent(); |
@@ -368,13 +371,13 @@ class WindowCycleView : public views::WidgetDelegateView { |
return window_view_map_[target_window_]; |
} |
- WmWindow* target_window() { return target_window_; } |
+ aura::Window* target_window() { return target_window_; } |
private: |
- std::map<WmWindow*, views::View*> window_view_map_; |
+ std::map<aura::Window*, views::View*> window_view_map_; |
views::View* mirror_container_; |
views::View* highlight_view_; |
- WmWindow* target_window_; |
+ aura::Window* target_window_; |
DISALLOW_COPY_AND_ASSIGN(WindowCycleView); |
}; |
@@ -385,8 +388,8 @@ WindowCycleList::WindowCycleList(const WindowList& windows) |
if (!ShouldShowUi()) |
Shell::Get()->mru_window_tracker()->SetIgnoreActivations(true); |
- for (WmWindow* window : windows_) |
- window->aura_window()->AddObserver(this); |
+ for (auto* window : windows_) |
+ window->AddObserver(this); |
if (ShouldShowUi()) { |
if (g_disable_initial_delay) { |
@@ -402,13 +405,13 @@ WindowCycleList::~WindowCycleList() { |
if (!ShouldShowUi()) |
Shell::Get()->mru_window_tracker()->SetIgnoreActivations(false); |
- for (WmWindow* window : windows_) |
- window->aura_window()->RemoveObserver(this); |
+ for (auto* window : windows_) |
+ window->RemoveObserver(this); |
if (!windows_.empty() && user_did_accept_) { |
- WmWindow* target_window = windows_[current_index_]; |
+ auto* target_window = windows_[current_index_]; |
target_window->Show(); |
- target_window->GetWindowState()->Activate(); |
+ ash::wm::GetWindowState(target_window)->Activate(); |
} |
if (cycle_ui_widget_) |
@@ -430,9 +433,9 @@ void WindowCycleList::Step(WindowCycleController::Direction direction) { |
// When there is only one window, we should give feedback to the user. If the |
// window is minimized, we should also show it. |
if (windows_.size() == 1) { |
- windows_[0]->Animate(::wm::WINDOW_ANIMATION_TYPE_BOUNCE); |
+ ::wm::AnimateWindow(windows_[0], ::wm::WINDOW_ANIMATION_TYPE_BOUNCE); |
windows_[0]->Show(); |
- windows_[0]->GetWindowState()->Activate(); |
+ ash::wm::GetWindowState(windows_[0])->Activate(); |
James Cook
2017/05/17 23:18:26
is ash:: needed here?
varkha
2017/05/18 00:18:29
Done.
|
return; |
} |
@@ -442,7 +445,8 @@ void WindowCycleList::Step(WindowCycleController::Direction direction) { |
// Special case the situation where we're cycling forward but the MRU window |
// is not active. This occurs when all windows are minimized. The starting |
// window should be the first one rather than the second. |
- if (direction == WindowCycleController::FORWARD && !windows_[0]->IsActive()) |
+ if (direction == WindowCycleController::FORWARD && |
+ !wm::IsActiveWindow(windows_[0])) |
current_index_ = -1; |
} |
@@ -470,8 +474,7 @@ void WindowCycleList::DisableInitialDelayForTesting() { |
void WindowCycleList::OnWindowDestroying(aura::Window* window) { |
window->RemoveObserver(this); |
- WindowList::iterator i = |
- std::find(windows_.begin(), windows_.end(), WmWindow::Get(window)); |
+ WindowList::iterator i = std::find(windows_.begin(), windows_.end(), window); |
// TODO(oshima): Change this back to DCHECK once crbug.com/483491 is fixed. |
CHECK(i != windows_.end()); |
int removed_index = static_cast<int>(i - windows_.begin()); |
@@ -482,10 +485,9 @@ void WindowCycleList::OnWindowDestroying(aura::Window* window) { |
} |
if (cycle_view_) { |
- WmWindow* new_target_window = |
+ auto* new_target_window = |
windows_.empty() ? nullptr : windows_[current_index_]; |
- cycle_view_->HandleWindowDestruction(WmWindow::Get(window), |
- new_target_window); |
+ cycle_view_->HandleWindowDestruction(window, new_target_window); |
if (windows_.empty()) { |
// This deletes us. |
Shell::Get()->window_cycle_controller()->CancelCycling(); |