OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/desktop_screen_x11.h" | 5 #include "ui/views/widget/desktop_aura/desktop_screen_x11.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 public: | 32 public: |
33 explicit ActivationWaiter(views::Widget* widget) | 33 explicit ActivationWaiter(views::Widget* widget) |
34 : x_root_window_(DefaultRootWindow(gfx::GetXDisplay())), | 34 : x_root_window_(DefaultRootWindow(gfx::GetXDisplay())), |
35 widget_xid_(0), | 35 widget_xid_(0), |
36 active_(false) { | 36 active_(false) { |
37 const char* kAtomToCache[] = { | 37 const char* kAtomToCache[] = { |
38 "_NET_ACTIVE_WINDOW", | 38 "_NET_ACTIVE_WINDOW", |
39 NULL | 39 NULL |
40 }; | 40 }; |
41 atom_cache_.reset(new ui::X11AtomCache(gfx::GetXDisplay(), kAtomToCache)); | 41 atom_cache_.reset(new ui::X11AtomCache(gfx::GetXDisplay(), kAtomToCache)); |
42 widget_xid_ = widget->GetNativeWindow()->GetDispatcher()->host()-> | 42 widget_xid_ = widget->GetNativeWindow()->GetHost()-> |
43 GetAcceleratedWidget(); | 43 GetAcceleratedWidget(); |
44 base::MessagePumpX11::Current()->AddDispatcherForRootWindow(this); | 44 base::MessagePumpX11::Current()->AddDispatcherForRootWindow(this); |
45 } | 45 } |
46 | 46 |
47 virtual ~ActivationWaiter() { | 47 virtual ~ActivationWaiter() { |
48 base::MessagePumpX11::Current()->RemoveDispatcherForRootWindow(this); | 48 base::MessagePumpX11::Current()->RemoveDispatcherForRootWindow(this); |
49 } | 49 } |
50 | 50 |
51 // Blocks till |widget_xid_| becomes active. | 51 // Blocks till |widget_xid_| becomes active. |
52 void Wait() { | 52 void Wait() { |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 screen()->GetDisplayNearestWindow(window_one->GetNativeWindow()).id()); | 316 screen()->GetDisplayNearestWindow(window_one->GetNativeWindow()).id()); |
317 EXPECT_EQ( | 317 EXPECT_EQ( |
318 kSecondDisplay, | 318 kSecondDisplay, |
319 screen()->GetDisplayNearestWindow(window_two->GetNativeWindow()).id()); | 319 screen()->GetDisplayNearestWindow(window_two->GetNativeWindow()).id()); |
320 | 320 |
321 window_one->CloseNow(); | 321 window_one->CloseNow(); |
322 window_two->CloseNow(); | 322 window_two->CloseNow(); |
323 } | 323 } |
324 | 324 |
325 } // namespace views | 325 } // namespace views |
OLD | NEW |