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

Side by Side Diff: chrome/browser/screensaver_window_finder_gtk.cc

Issue 10560014: Aura desktop: Fix tab dragging within a single chrome window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix filename so windows is excluded. Created 8 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/fullscreen_gtk.cc ('k') | chrome/browser/ui/aura/tabs/dock_info_aura.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/screensaver_window_finder_gtk.h" 5 #include "chrome/browser/screensaver_window_finder_gtk.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 "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "chrome/browser/ui/gtk/gtk_util.h"
12 #include "ui/base/x/x11_util.h" 11 #include "ui/base/x/x11_util.h"
13 12
14 13
15 ScreensaverWindowFinder::ScreensaverWindowFinder() 14 ScreensaverWindowFinder::ScreensaverWindowFinder()
16 : exists_(false) { 15 : exists_(false) {
17 } 16 }
18 17
19 bool ScreensaverWindowFinder::ScreensaverWindowExists() { 18 bool ScreensaverWindowFinder::ScreensaverWindowExists() {
20 gdk_error_trap_push(); 19 gdk_error_trap_push();
21 ScreensaverWindowFinder finder; 20 ScreensaverWindowFinder finder;
22 gtk_util::EnumerateTopLevelWindows(&finder); 21 ui::EnumerateTopLevelWindows(&finder);
23 bool got_error = gdk_error_trap_pop(); 22 bool got_error = gdk_error_trap_pop();
24 return finder.exists_ && !got_error; 23 return finder.exists_ && !got_error;
25 } 24 }
26 25
27 bool ScreensaverWindowFinder::ShouldStopIterating(XID window) { 26 bool ScreensaverWindowFinder::ShouldStopIterating(XID window) {
28 if (!ui::IsWindowVisible(window) || !IsScreensaverWindow(window)) 27 if (!ui::IsWindowVisible(window) || !IsScreensaverWindow(window))
29 return false; 28 return false;
30 exists_ = true; 29 exists_ = true;
31 return true; 30 return true;
32 } 31 }
33 32
34 bool ScreensaverWindowFinder::IsScreensaverWindow(XID window) const { 33 bool ScreensaverWindowFinder::IsScreensaverWindow(XID window) const {
35 // It should occupy the full screen. 34 // It should occupy the full screen.
36 if (!ui::IsX11WindowFullScreen(window)) 35 if (!ui::IsX11WindowFullScreen(window))
37 return false; 36 return false;
38 37
39 // For xscreensaver, the window should have _SCREENSAVER_VERSION property. 38 // For xscreensaver, the window should have _SCREENSAVER_VERSION property.
40 if (ui::PropertyExists(window, "_SCREENSAVER_VERSION")) 39 if (ui::PropertyExists(window, "_SCREENSAVER_VERSION"))
41 return true; 40 return true;
42 41
43 // For all others, like gnome-screensaver, the window's WM_CLASS property 42 // For all others, like gnome-screensaver, the window's WM_CLASS property
44 // should contain "screensaver". 43 // should contain "screensaver".
45 std::string value; 44 std::string value;
46 if (!ui::GetStringProperty(window, "WM_CLASS", &value)) 45 if (!ui::GetStringProperty(window, "WM_CLASS", &value))
47 return false; 46 return false;
48 47
49 return value.find("screensaver") != std::string::npos; 48 return value.find("screensaver") != std::string::npos;
50 } 49 }
OLDNEW
« no previous file with comments | « chrome/browser/fullscreen_gtk.cc ('k') | chrome/browser/ui/aura/tabs/dock_info_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698