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

Side by Side 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 sadrul's feedback, adding license header. 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 unified diff | Download patch
« no previous file with comments | « athena/wm/mru_window_tracker.h ('k') | athena/wm/public/window_list_provider.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "athena/wm/mru_window_tracker.h"
6
7 #include "ui/aura/window.h"
8
9 namespace athena {
10
11 MruWindowTracker::MruWindowTracker(aura::Window* container)
12 : container_(container) {
13 container->AddObserver(this);
14 }
15
16 MruWindowTracker::~MruWindowTracker() {
17 if (container_)
18 container_->RemoveObserver(this);
19 }
20
21 aura::Window::Windows MruWindowTracker::GetWindowList() const {
22 return aura::Window::Windows(mru_windows_.begin(), mru_windows_.end());
23 }
24
25 void MruWindowTracker::MoveToFront(aura::Window* window) {
26 DCHECK(window);
27 CHECK_EQ(container_, window->parent());
28 std::list<aura::Window*>::iterator it =
29 std::find(mru_windows_.begin(), mru_windows_.end(), window);
30 DCHECK(it != mru_windows_.end());
31 mru_windows_.erase(it);
32 mru_windows_.push_back(window);
33 }
34
35 // Overridden from WindowObserver:
36 void MruWindowTracker::OnWillRemoveWindow(aura::Window* window) {
37 std::list<aura::Window*>::iterator it =
38 std::find(mru_windows_.begin(), mru_windows_.end(), window);
39 if (it == mru_windows_.end()) {
40 // All normal windows should be tracked in mru_windows_
41 DCHECK_NE(window->type(), ui::wm::WINDOW_TYPE_NORMAL);
42 return;
43 }
44 mru_windows_.erase(it);
45 }
46
47 void MruWindowTracker::OnWindowAdded(aura::Window* new_window) {
48 // We are only interested in ordering normal windows.
49 if (new_window->type() == ui::wm::WINDOW_TYPE_NORMAL)
50 mru_windows_.push_back(new_window);
51 }
52
53 } // namespace athena
OLDNEW
« no previous file with comments | « athena/wm/mru_window_tracker.h ('k') | athena/wm/public/window_list_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698