summaryrefslogtreecommitdiffstats
path: root/ui/views/win/scoped_fullscreen_visibility.h
blob: b78b800ee18f6caac36fe6c165be79a3cf03d10c (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
41
// 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 UI_VIEWS_WIN_SCOPED_FULLSCREEN_VISIBILITY_H_
#define UI_VIEWS_WIN_SCOPED_FULLSCREEN_VISIBILITY_H_

#include <windows.h>

#include <map>

#include "base/basictypes.h"
#include "ui/views/views_export.h"

namespace views {

// Scoping class that ensures a HWND remains hidden while it enters or leaves
// the fullscreen state. This reduces some flicker-jank that an application UI
// might suffer.
class VIEWS_EXPORT ScopedFullscreenVisibility {
 public:
  explicit ScopedFullscreenVisibility(HWND hwnd);
  ~ScopedFullscreenVisibility();

  // Returns true if |hwnd| is currently hidden due to instance(s) of this
  // class.
  static bool IsHiddenForFullscreen(HWND hwnd);

 private:
  typedef std::map<HWND, int> FullscreenHWNDs;

  HWND hwnd_;

  static FullscreenHWNDs* full_screen_windows_;

  DISALLOW_COPY_AND_ASSIGN(ScopedFullscreenVisibility);
};

}  // namespace views

#endif  // UI_VIEWS_WIN_SCOPED_FULLSCREEN_VISIBILITY_H_