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

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

Issue 24160005: Move ui/base/x/x11_error_tracker to base/x11. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebase Created 7 years, 2 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
« no previous file with comments | « base/x11/x11_error_tracker_gtk.cc ('k') | ui/base/x/x11_error_tracker.h » ('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) 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/screensaver_window_finder_x11.h" 5 #include "chrome/browser/screensaver_window_finder_x11.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "ui/base/x/x11_error_tracker.h" 8 #include "base/x11/x11_error_tracker.h"
9 #include "ui/base/x/x11_util.h" 9 #include "ui/base/x/x11_util.h"
10 10
11 ScreensaverWindowFinder::ScreensaverWindowFinder() 11 ScreensaverWindowFinder::ScreensaverWindowFinder()
12 : exists_(false) { 12 : exists_(false) {
13 } 13 }
14 14
15 bool ScreensaverWindowFinder::ScreensaverWindowExists() { 15 bool ScreensaverWindowFinder::ScreensaverWindowExists() {
16 ui::X11ErrorTracker err_tracker; 16 base::X11ErrorTracker err_tracker;
17 ScreensaverWindowFinder finder; 17 ScreensaverWindowFinder finder;
18 ui::EnumerateTopLevelWindows(&finder); 18 ui::EnumerateTopLevelWindows(&finder);
19 return finder.exists_ && !err_tracker.FoundNewError(); 19 return finder.exists_ && !err_tracker.FoundNewError();
20 } 20 }
21 21
22 bool ScreensaverWindowFinder::ShouldStopIterating(XID window) { 22 bool ScreensaverWindowFinder::ShouldStopIterating(XID window) {
23 if (!ui::IsWindowVisible(window) || !IsScreensaverWindow(window)) 23 if (!ui::IsWindowVisible(window) || !IsScreensaverWindow(window))
24 return false; 24 return false;
25 exists_ = true; 25 exists_ = true;
26 return true; 26 return true;
27 } 27 }
28 28
29 bool ScreensaverWindowFinder::IsScreensaverWindow(XID window) const { 29 bool ScreensaverWindowFinder::IsScreensaverWindow(XID window) const {
30 // It should occupy the full screen. 30 // It should occupy the full screen.
31 if (!ui::IsX11WindowFullScreen(window)) 31 if (!ui::IsX11WindowFullScreen(window))
32 return false; 32 return false;
33 33
34 // For xscreensaver, the window should have _SCREENSAVER_VERSION property. 34 // For xscreensaver, the window should have _SCREENSAVER_VERSION property.
35 if (ui::PropertyExists(window, "_SCREENSAVER_VERSION")) 35 if (ui::PropertyExists(window, "_SCREENSAVER_VERSION"))
36 return true; 36 return true;
37 37
38 // For all others, like gnome-screensaver, the window's WM_CLASS property 38 // For all others, like gnome-screensaver, the window's WM_CLASS property
39 // should contain "screensaver". 39 // should contain "screensaver".
40 std::string value; 40 std::string value;
41 if (!ui::GetStringProperty(window, "WM_CLASS", &value)) 41 if (!ui::GetStringProperty(window, "WM_CLASS", &value))
42 return false; 42 return false;
43 43
44 return value.find("screensaver") != std::string::npos; 44 return value.find("screensaver") != std::string::npos;
45 } 45 }
OLDNEW
« no previous file with comments | « base/x11/x11_error_tracker_gtk.cc ('k') | ui/base/x/x11_error_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698