blob: ff63984a9e8fa21d27523b182a88be33f7db1791 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
// Copyright (c) 2012 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.
#ifndef CHROME_BROWSER_UI_AURA_ACTIVE_DESKTOP_MONITOR_H_
#define CHROME_BROWSER_UI_AURA_ACTIVE_DESKTOP_MONITOR_H_
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "chrome/browser/ui/host_desktop.h"
#include "ui/aura/env_observer.h"
// Tracks the most-recently activated host desktop type by observing
// RootWindowHost activations.
class ActiveDesktopMonitor : public aura::EnvObserver {
public:
ActiveDesktopMonitor();
virtual ~ActiveDesktopMonitor();
// Returns the host desktop type of the most-recently activated
// RootWindowHost. This desktop type may no longer exist (e.g., the Ash
// desktop may have closed since being active, and no RWHs on the native
// desktop have yet been activated).
static chrome::HostDesktopType GetLastActivatedDesktopType();
private:
// Returns true if |root_window| is hosted by a DesktopRootWindowHost.
static bool IsDesktopWindow(aura::RootWindow* root_window);
// aura::EnvObserver methods.
virtual void OnWindowInitialized(aura::Window* window) OVERRIDE;
virtual void OnRootWindowActivated(aura::RootWindow* root_window) OVERRIDE;
static ActiveDesktopMonitor* g_instance_;
chrome::HostDesktopType last_activated_desktop_;
DISALLOW_COPY_AND_ASSIGN(ActiveDesktopMonitor);
};
#endif // CHROME_BROWSER_UI_AURA_ACTIVE_DESKTOP_MONITOR_H_
|