Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2858)

Unified Diff: ash/common/wm/window_cycle_list.cc

Issue 2699033002: Replace WmWindowObserver with aura::WindowObserver. (Closed)
Patch Set: Check for null images in ShelfWindowWatcher. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/common/wm/window_cycle_list.h ('k') | ash/common/wm/window_dimmer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/wm/window_cycle_list.cc
diff --git a/ash/common/wm/window_cycle_list.cc b/ash/common/wm/window_cycle_list.cc
index fd63499ac5e4305c752e7737400f1050df69eb8a..78c7a771a552403f7448237bfe7a6cc95349e376 100644
--- a/ash/common/wm/window_cycle_list.cc
+++ b/ash/common/wm/window_cycle_list.cc
@@ -62,14 +62,14 @@ class LayerFillBackgroundPainter : public views::Background {
// This view represents a single WmWindow by displaying a title and a thumbnail
// of the window's contents.
-class WindowPreviewView : public views::View, public WmWindowObserver {
+class WindowPreviewView : public views::View, public aura::WindowObserver {
public:
explicit WindowPreviewView(WmWindow* window)
: window_title_(new views::Label),
preview_background_(new views::View),
mirror_view_(window->CreateViewWithRecreatedLayers().release()),
window_observer_(this) {
- window_observer_.Add(window);
+ window_observer_.Add(window->aura_window());
window_title_->SetText(window->GetTitle());
window_title_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
window_title_->SetEnabledColor(SK_ColorWHITE);
@@ -135,12 +135,12 @@ class WindowPreviewView : public views::View, public WmWindowObserver {
node_data->SetName(window_title_->text());
}
- // WmWindowObserver:
- void OnWindowDestroying(WmWindow* window) override {
+ // aura::WindowObserver:
+ void OnWindowDestroying(aura::Window* window) override {
window_observer_.Remove(window);
}
- void OnWindowTitleChanged(WmWindow* window) override {
+ void OnWindowTitleChanged(aura::Window* window) override {
window_title_->SetText(window->GetTitle());
}
@@ -200,7 +200,7 @@ class WindowPreviewView : public views::View, public WmWindowObserver {
// The view that actually renders a thumbnail version of the window.
views::View* mirror_view_;
- ScopedObserver<WmWindow, WmWindowObserver> window_observer_;
+ ScopedObserver<aura::Window, aura::WindowObserver> window_observer_;
DISALLOW_COPY_AND_ASSIGN(WindowPreviewView);
};
@@ -386,7 +386,7 @@ WindowCycleList::WindowCycleList(const WindowList& windows)
WmShell::Get()->mru_window_tracker()->SetIgnoreActivations(true);
for (WmWindow* window : windows_)
- window->AddObserver(this);
+ window->aura_window()->AddObserver(this);
if (ShouldShowUi()) {
if (g_disable_initial_delay) {
@@ -403,7 +403,7 @@ WindowCycleList::~WindowCycleList() {
WmShell::Get()->mru_window_tracker()->SetIgnoreActivations(false);
for (WmWindow* window : windows_)
- window->RemoveObserver(this);
+ window->aura_window()->RemoveObserver(this);
if (!windows_.empty() && user_did_accept_) {
WmWindow* target_window = windows_[current_index_];
@@ -467,10 +467,11 @@ void WindowCycleList::DisableInitialDelayForTesting() {
g_disable_initial_delay = true;
}
-void WindowCycleList::OnWindowDestroying(WmWindow* window) {
+void WindowCycleList::OnWindowDestroying(aura::Window* window) {
window->RemoveObserver(this);
- WindowList::iterator i = std::find(windows_.begin(), windows_.end(), window);
+ WindowList::iterator i =
+ std::find(windows_.begin(), windows_.end(), WmWindow::Get(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());
@@ -483,7 +484,8 @@ void WindowCycleList::OnWindowDestroying(WmWindow* window) {
if (cycle_view_) {
WmWindow* new_target_window =
windows_.empty() ? nullptr : windows_[current_index_];
- cycle_view_->HandleWindowDestruction(window, new_target_window);
+ cycle_view_->HandleWindowDestruction(WmWindow::Get(window),
+ new_target_window);
if (windows_.empty()) {
// This deletes us.
WmShell::Get()->window_cycle_controller()->CancelCycling();
« no previous file with comments | « ash/common/wm/window_cycle_list.h ('k') | ash/common/wm/window_dimmer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698