platformKeys: Add per-extension sign permissions.
[chromium-blink-merge.git] / ash / wm / mru_window_tracker.h
blobf32f708a3a210cd5549f89561897e1d38c8e12e7
1 // Copyright 2013 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.
5 #ifndef ASH_WM_MRU_WINDOW_TRACKER_H_
6 #define ASH_WM_MRU_WINDOW_TRACKER_H_
8 #include <list>
9 #include <vector>
11 #include "ash/ash_export.h"
12 #include "base/basictypes.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "ui/aura/window_observer.h"
15 #include "ui/wm/public/activation_change_observer.h"
17 namespace aura {
18 class RootWindow;
19 class Window;
20 namespace client {
21 class ActivationClient;
25 namespace ash {
27 namespace wm {
29 class AshFocusRules;
31 } // namespace wm
34 // Maintains a most recently used list of windows. This is used for window
35 // cycling using Alt+Tab and overview mode.
36 class ASH_EXPORT MruWindowTracker
37 : public aura::client::ActivationChangeObserver,
38 public aura::WindowObserver {
39 public:
40 typedef std::vector<aura::Window*> WindowList;
42 MruWindowTracker(
43 aura::client::ActivationClient* activation_client,
44 ash::wm::AshFocusRules* focus_rules);
45 ~MruWindowTracker() override;
47 // Returns the set of windows which can be cycled through using the tracked
48 // list of most recently used windows.
49 WindowList BuildMruWindowList() const;
51 // This does the same thing as the above, but ignores the system modal dialog
52 // state and hence the returned list could contain more windows if a system
53 // modal dialog window is present.
54 WindowList BuildWindowListIgnoreModal() const;
56 // Starts or stops ignoring window activations. If no longer ignoring
57 // activations the currently active window is moved to the front of the
58 // MRU window list. Used by WindowCycleList to avoid adding all cycled
59 // windows to the front of the MRU window list.
60 void SetIgnoreActivations(bool ignore);
62 private:
63 // Updates the mru_windows_ list to insert/move |active_window| at/to the
64 // front.
65 void SetActiveWindow(aura::Window* active_window);
67 // Overridden from aura::client::ActivationChangeObserver:
68 void OnWindowActivated(aura::Window* gained_active,
69 aura::Window* lost_active) override;
71 // Overridden from WindowObserver:
72 void OnWindowDestroyed(aura::Window* window) override;
74 // Uses the focus rules to check whether the window can be activateable,
75 // regardless of the state of the System modal dialog.
76 bool IsWindowConsideredActivateable(aura::Window* window) const;
78 // List of windows that have been activated in containers that we cycle
79 // through, sorted by most recently used.
80 std::list<aura::Window*> mru_windows_;
82 aura::client::ActivationClient* activation_client_; // Not owned.
84 wm::AshFocusRules* focus_rules_; // Not owned.
86 bool ignore_window_activations_;
88 DISALLOW_COPY_AND_ASSIGN(MruWindowTracker);
91 } // namespace ash
93 #endif // ASH_WM_MRU_WINDOW_TRACKER_H_