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

Unified Diff: ui/views/win/scoped_fullscreen_visibility.cc

Issue 10871020: Move Fullscreen stuff onto FullscreenHandler type that hangs off NWW. This is the first step in mov… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/win/scoped_fullscreen_visibility.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/win/scoped_fullscreen_visibility.cc
===================================================================
--- ui/views/win/scoped_fullscreen_visibility.cc (revision 0)
+++ ui/views/win/scoped_fullscreen_visibility.cc (revision 0)
@@ -0,0 +1,53 @@
+// 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.
+
+#include "ui/views/win/scoped_fullscreen_visibility.h"
+
+#include "base/logging.h"
+
+namespace views {
+
+// static
+std::map<HWND, int>* ScopedFullscreenVisibility::full_screen_windows_ = NULL;
+
+ScopedFullscreenVisibility::ScopedFullscreenVisibility(HWND hwnd)
+ : hwnd_(hwnd) {
+ if (!full_screen_windows_)
+ full_screen_windows_ = new FullscreenHWNDs;
+ FullscreenHWNDs::iterator it = full_screen_windows_->find(hwnd_);
+ if (it != full_screen_windows_->end()) {
+ it->second++;
+ } else {
+ full_screen_windows_->insert(std::make_pair(hwnd_, 1));
+ // NOTE: Be careful not to activate any windows here (for example, calling
+ // ShowWindow(SW_HIDE) will automatically activate another window). This
+ // code can be called while a window is being deactivated, and activating
+ // another window will screw up the activation that is already in progress.
+ SetWindowPos(hwnd_, NULL, 0, 0, 0, 0,
+ SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOMOVE |
+ SWP_NOREPOSITION | SWP_NOSIZE | SWP_NOZORDER);
+ }
+}
+
+ScopedFullscreenVisibility::~ScopedFullscreenVisibility() {
+ FullscreenHWNDs::iterator it = full_screen_windows_->find(hwnd_);
+ DCHECK(it != full_screen_windows_->end());
+ if (--it->second == 0) {
+ full_screen_windows_->erase(it);
+ ShowWindow(hwnd_, SW_SHOW);
+ }
+ if (full_screen_windows_->empty()) {
+ delete full_screen_windows_;
+ full_screen_windows_ = NULL;
+ }
+}
+
+// static
+bool ScopedFullscreenVisibility::IsHiddenForFullscreen(HWND hwnd) {
+ if (!full_screen_windows_)
+ return false;
+ return full_screen_windows_->find(hwnd) != full_screen_windows_->end();
+}
+
+} // namespace views
« no previous file with comments | « ui/views/win/scoped_fullscreen_visibility.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698