| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/fullscreen.h" | 5 #include "chrome/browser/fullscreen.h" |
| 6 | 6 |
| 7 #include <gdk/gdk.h> | 7 #include <gdk/gdk.h> |
| 8 #include <gdk/gdkx.h> | 8 #include <gdk/gdkx.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 // child window as the top-most window. | 53 // child window as the top-most window. |
| 54 // 2.4) Otherwise, continue the iteration. | 54 // 2.4) Otherwise, continue the iteration. |
| 55 | 55 |
| 56 class WindowManagerWindowFinder : public ui::EnumerateWindowsDelegate { | 56 class WindowManagerWindowFinder : public ui::EnumerateWindowsDelegate { |
| 57 public: | 57 public: |
| 58 WindowManagerWindowFinder() : window_(None) { } | 58 WindowManagerWindowFinder() : window_(None) { } |
| 59 | 59 |
| 60 XID window() const { return window_; } | 60 XID window() const { return window_; } |
| 61 | 61 |
| 62 protected: | 62 protected: |
| 63 virtual bool ShouldStopIterating(XID window) { | 63 virtual bool ShouldStopIterating(XID window) OVERRIDE { |
| 64 if (ui::PropertyExists(window, "WM_STATE")) { | 64 if (ui::PropertyExists(window, "WM_STATE")) { |
| 65 window_ = window; | 65 window_ = window; |
| 66 return true; | 66 return true; |
| 67 } | 67 } |
| 68 return false; | 68 return false; |
| 69 } | 69 } |
| 70 | 70 |
| 71 private: | 71 private: |
| 72 XID window_; | 72 XID window_; |
| 73 | 73 |
| 74 DISALLOW_COPY_AND_ASSIGN(WindowManagerWindowFinder); | 74 DISALLOW_COPY_AND_ASSIGN(WindowManagerWindowFinder); |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 class TopMostWindowFinder : public ui::EnumerateWindowsDelegate { | 77 class TopMostWindowFinder : public ui::EnumerateWindowsDelegate { |
| 78 public: | 78 public: |
| 79 TopMostWindowFinder() | 79 TopMostWindowFinder() |
| 80 : top_most_window_(None) {} | 80 : top_most_window_(None) {} |
| 81 | 81 |
| 82 XID top_most_window() const { return top_most_window_; } | 82 XID top_most_window() const { return top_most_window_; } |
| 83 | 83 |
| 84 protected: | 84 protected: |
| 85 virtual bool ShouldStopIterating(XID window) { | 85 virtual bool ShouldStopIterating(XID window) OVERRIDE { |
| 86 if (!ui::IsWindowVisible(window)) | 86 if (!ui::IsWindowVisible(window)) |
| 87 return false; | 87 return false; |
| 88 if (ui::PropertyExists(window, "WM_STATE")) { | 88 if (ui::PropertyExists(window, "WM_STATE")) { |
| 89 top_most_window_ = window; | 89 top_most_window_ = window; |
| 90 return true; | 90 return true; |
| 91 } | 91 } |
| 92 WindowManagerWindowFinder child_finder; | 92 WindowManagerWindowFinder child_finder; |
| 93 EnumerateAllChildWindows(&child_finder, window); | 93 EnumerateAllChildWindows(&child_finder, window); |
| 94 XID child_window = child_finder.window(); | 94 XID child_window = child_finder.window(); |
| 95 if (child_window == None) | 95 if (child_window == None) |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 } | 134 } |
| 135 | 135 |
| 136 } | 136 } |
| 137 | 137 |
| 138 bool IsFullScreenMode() { | 138 bool IsFullScreenMode() { |
| 139 gdk_error_trap_push(); | 139 gdk_error_trap_push(); |
| 140 bool result = IsTopMostWindowFullScreen(); | 140 bool result = IsTopMostWindowFullScreen(); |
| 141 bool got_error = gdk_error_trap_pop(); | 141 bool got_error = gdk_error_trap_pop(); |
| 142 return result && !got_error; | 142 return result && !got_error; |
| 143 } | 143 } |
| OLD | NEW |