| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "mojo/services/native_viewport/native_viewport.h" | 5 #include "mojo/services/native_viewport/native_viewport.h" |
| 6 | 6 |
| 7 #include <X11/Xlib.h> | 7 #include <X11/Xlib.h> |
| 8 | 8 |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/message_loop/message_pump_x11.h" | 10 #include "base/message_loop/message_pump_x11.h" |
| 11 #include "ui/gfx/rect.h" | 11 #include "ui/gfx/rect.h" |
| 12 #include "ui/gfx/x/x11_types.h" | 12 #include "ui/gfx/x/x11_types.h" |
| 13 | 13 |
| 14 namespace mojo { | 14 namespace mojo { |
| 15 namespace services { | 15 namespace services { |
| 16 | 16 |
| 17 class NativeViewportX11 : public NativeViewport, | 17 class NativeViewportX11 : public NativeViewport, |
| 18 public base::MessagePumpDispatcher { | 18 public base::MessagePumpDispatcher { |
| 19 public: | 19 public: |
| 20 NativeViewportX11(NativeViewportDelegate* delegate) | 20 NativeViewportX11(NativeViewportDelegate* delegate) |
| 21 : delegate_(delegate), | 21 : delegate_(delegate), |
| 22 bounds_(10, 10, 500, 500) { | 22 bounds_(10, 10, 800, 600) { |
| 23 } | 23 } |
| 24 | 24 |
| 25 virtual ~NativeViewportX11() { | 25 virtual ~NativeViewportX11() { |
| 26 base::MessagePumpX11::Current()->RemoveDispatcherForRootWindow(this); | 26 base::MessagePumpX11::Current()->RemoveDispatcherForRootWindow(this); |
| 27 base::MessagePumpX11::Current()->RemoveDispatcherForWindow(window_); | 27 base::MessagePumpX11::Current()->RemoveDispatcherForWindow(window_); |
| 28 | 28 |
| 29 XDestroyWindow(gfx::GetXDisplay(), window_); | 29 XDestroyWindow(gfx::GetXDisplay(), window_); |
| 30 } | 30 } |
| 31 | 31 |
| 32 private: | 32 private: |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 87 |
| 88 // static | 88 // static |
| 89 scoped_ptr<NativeViewport> NativeViewport::Create( | 89 scoped_ptr<NativeViewport> NativeViewport::Create( |
| 90 shell::Context* context, | 90 shell::Context* context, |
| 91 NativeViewportDelegate* delegate) { | 91 NativeViewportDelegate* delegate) { |
| 92 return scoped_ptr<NativeViewport>(new NativeViewportX11(delegate)).Pass(); | 92 return scoped_ptr<NativeViewport>(new NativeViewportX11(delegate)).Pass(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 } // namespace services | 95 } // namespace services |
| 96 } // namespace mojo | 96 } // namespace mojo |
| OLD | NEW |