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

Side by Side Diff: ui/views/widget/desktop_aura/x11_topmost_window_finder_interactive_uitest.cc

Issue 1675483002: Allow use of container cbegin() and cend() methods, plus sample uses. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add note about non-member cbegin() and cend(). Created 4 years, 10 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 | « ui/views/widget/desktop_aura/desktop_window_tree_host_x11_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/views/widget/desktop_aura/x11_topmost_window_finder.h" 5 #include "ui/views/widget/desktop_aura/x11_topmost_window_finder.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <X11/extensions/shape.h> 8 #include <X11/extensions/shape.h>
9 #include <X11/Xlib.h> 9 #include <X11/Xlib.h>
10 #include <X11/Xregion.h> 10 #include <X11/Xregion.h>
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 atom_cache_.reset(new ui::X11AtomCache(gfx::GetXDisplay(), kAtomsToCache)); 48 atom_cache_.reset(new ui::X11AtomCache(gfx::GetXDisplay(), kAtomsToCache));
49 } 49 }
50 50
51 ~MinimizeWaiter() override {} 51 ~MinimizeWaiter() override {}
52 52
53 private: 53 private:
54 // X11PropertyChangeWaiter: 54 // X11PropertyChangeWaiter:
55 bool ShouldKeepOnWaiting(const ui::PlatformEvent& event) override { 55 bool ShouldKeepOnWaiting(const ui::PlatformEvent& event) override {
56 std::vector<Atom> wm_states; 56 std::vector<Atom> wm_states;
57 if (ui::GetAtomArrayProperty(xwindow(), "_NET_WM_STATE", &wm_states)) { 57 if (ui::GetAtomArrayProperty(xwindow(), "_NET_WM_STATE", &wm_states)) {
58 std::vector<Atom>::iterator it = std::find( 58 auto it = std::find(wm_states.cbegin(), wm_states.cend(),
59 wm_states.begin(), 59 atom_cache_->GetAtom("_NET_WM_STATE_HIDDEN"));
60 wm_states.end(), 60 return it == wm_states.cend();
61 atom_cache_->GetAtom("_NET_WM_STATE_HIDDEN"));
62 return it == wm_states.end();
63 } 61 }
64 return true; 62 return true;
65 } 63 }
66 64
67 scoped_ptr<ui::X11AtomCache> atom_cache_; 65 scoped_ptr<ui::X11AtomCache> atom_cache_;
68 66
69 DISALLOW_COPY_AND_ASSIGN(MinimizeWaiter); 67 DISALLOW_COPY_AND_ASSIGN(MinimizeWaiter);
70 }; 68 };
71 69
72 // Waits till |_NET_CLIENT_LIST_STACKING| is updated to include 70 // Waits till |_NET_CLIENT_LIST_STACKING| is updated to include
(...skipping 17 matching lines...) Expand all
90 88
91 X11PropertyChangeWaiter::Wait(); 89 X11PropertyChangeWaiter::Wait();
92 } 90 }
93 91
94 private: 92 private:
95 // X11PropertyChangeWaiter: 93 // X11PropertyChangeWaiter:
96 bool ShouldKeepOnWaiting(const ui::PlatformEvent& event) override { 94 bool ShouldKeepOnWaiting(const ui::PlatformEvent& event) override {
97 std::vector<XID> stack; 95 std::vector<XID> stack;
98 ui::GetXWindowStack(ui::GetX11RootWindow(), &stack); 96 ui::GetXWindowStack(ui::GetX11RootWindow(), &stack);
99 for (size_t i = 0; i < expected_windows_.size(); ++i) { 97 for (size_t i = 0; i < expected_windows_.size(); ++i) {
100 std::vector<XID>::iterator it = std::find( 98 auto it = std::find(stack.cbegin(), stack.cend(), expected_windows_[i]);
101 stack.begin(), stack.end(), expected_windows_[i]); 99 if (it == stack.cend())
102 if (it == stack.end())
103 return true; 100 return true;
104 } 101 }
105 return false; 102 return false;
106 } 103 }
107 104
108 std::vector<XID> expected_windows_; 105 std::vector<XID> expected_windows_;
109 106
110 DISALLOW_COPY_AND_ASSIGN(StackingClientListWaiter); 107 DISALLOW_COPY_AND_ASSIGN(StackingClientListWaiter);
111 }; 108 };
112 109
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 432
436 EXPECT_EQ(xid, FindTopmostXWindowAt(110, 110)); 433 EXPECT_EQ(xid, FindTopmostXWindowAt(110, 110));
437 EXPECT_EQ(menu_xid, FindTopmostXWindowAt(150, 120)); 434 EXPECT_EQ(menu_xid, FindTopmostXWindowAt(150, 120));
438 EXPECT_EQ(menu_xid, FindTopmostXWindowAt(210, 120)); 435 EXPECT_EQ(menu_xid, FindTopmostXWindowAt(210, 120));
439 436
440 XDestroyWindow(xdisplay(), xid); 437 XDestroyWindow(xdisplay(), xid);
441 XDestroyWindow(xdisplay(), menu_xid); 438 XDestroyWindow(xdisplay(), menu_xid);
442 } 439 }
443 440
444 } // namespace views 441 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_window_tree_host_x11_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698