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

Unified Diff: athena/wm/mru_window_tracker.cc

Issue 420603011: Split Screen mode implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@split_view
Patch Set: Addressing mukai's review feedback. Created 6 years, 4 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
Index: athena/wm/mru_window_tracker.cc
diff --git a/athena/wm/mru_window_tracker.cc b/athena/wm/mru_window_tracker.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b898945d61ff7efb7f3311f1df8273e5404847ab
--- /dev/null
+++ b/athena/wm/mru_window_tracker.cc
@@ -0,0 +1,46 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "athena/wm/mru_window_tracker.h"
+
+#include "ui/aura/window.h"
+
+namespace athena {
+
+MruWindowTracker::MruWindowTracker(aura::Window* container)
+ : container_(container) {
+ container->AddObserver(this);
+}
+
+MruWindowTracker::~MruWindowTracker() {
+ if (container_)
+ container_->RemoveObserver(this);
+}
+
+aura::Window::Windows MruWindowTracker::GetWindowList() {
+ return aura::Window::Windows(mru_windows_.begin(), mru_windows_.end());
+}
+
+void MruWindowTracker::MoveToFront(aura::Window* window) {
+ DCHECK(window);
+ CHECK_EQ(container_, window->parent());
+ std::list<aura::Window*>::iterator it = std::find(
+ mru_windows_.begin(), mru_windows_.end(), window);
+ DCHECK(it != mru_windows_.end());
+ mru_windows_.erase(it);
+ mru_windows_.push_back(window);
+}
+
+// Overridden from WindowObserver:
+void MruWindowTracker::OnWillRemoveWindow(aura::Window* window) {
+ std::list<aura::Window*>::iterator it = std::find(
+ mru_windows_.begin(), mru_windows_.end(), window);
+ mru_windows_.erase(it);
+}
+
+void MruWindowTracker::OnWindowAdded(aura::Window* new_window) {
+ mru_windows_.push_back(new_window);
+}
+
+} // namespace athena

Powered by Google App Engine
This is Rietveld 408576698