1// Copyright (c) 2012 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#ifndef UI_VIEWS_WIN_SCOPED_FULLSCREEN_VISIBILITY_H_
6#define UI_VIEWS_WIN_SCOPED_FULLSCREEN_VISIBILITY_H_
7
8#include <windows.h>
9
10#include <map>
11
12#include "base/basictypes.h"
13#include "ui/views/views_export.h"
14
15namespace views {
16
17// Scoping class that ensures a HWND remains hidden while it enters or leaves
18// the fullscreen state. This reduces some flicker-jank that an application UI
19// might suffer.
20class VIEWS_EXPORT ScopedFullscreenVisibility {
21 public:
22  explicit ScopedFullscreenVisibility(HWND hwnd);
23  ~ScopedFullscreenVisibility();
24
25  // Returns true if |hwnd| is currently hidden due to instance(s) of this
26  // class.
27  static bool IsHiddenForFullscreen(HWND hwnd);
28
29 private:
30  typedef std::map<HWND, int> FullscreenHWNDs;
31
32  HWND hwnd_;
33
34  static FullscreenHWNDs* full_screen_windows_;
35
36  DISALLOW_COPY_AND_ASSIGN(ScopedFullscreenVisibility);
37};
38
39}  // namespace views
40
41#endif  // UI_VIEWS_WIN_SCOPED_FULLSCREEN_VISIBILITY_H_
42