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

Unified Diff: wm/host/foreign_window_host_linux.cc

Issue 11485006: Add window manager component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Push gfx::AcceleratedWidget usage into platform specific code. Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « wm/host/foreign_window_host_linux.h ('k') | wm/host/root_window_host_factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: wm/host/foreign_window_host_linux.cc
diff --git a/wm/host/foreign_window_host_linux.cc b/wm/host/foreign_window_host_linux.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a433ca90c8ec9e9075f819837cbcc8cea465c7e9
--- /dev/null
+++ b/wm/host/foreign_window_host_linux.cc
@@ -0,0 +1,68 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "wm/host/foreign_window_host_linux.h"
+
+#include <X11/extensions/Xdamage.h>
+
+#include "wm/host/foreign_window_host_delegate.h"
+
+namespace wm {
+
+ForeignWindowHostLinux::ForeignWindowHostLinux(
+ gfx::PluginWindowHandle window_handle) :
+ xdisplay_(base::MessagePumpAuraX11::GetDefaultXDisplay()),
+ window_handle_(window_handle),
+ delegate_(NULL) {
+ DCHECK(window_handle_);
+ // Damage resource is automatically freed when the window is destroyed or
+ // we close our connection to the X server.
+ // TODO(reveman): Ignore possible X error.
+ XDamageCreate(xdisplay_, window_handle_, XDamageReportRawRectangles);
+ base::MessagePumpAuraX11::Current()->AddDispatcherForWindow(
+ this, window_handle_);
+}
+
+ForeignWindowHostLinux::~ForeignWindowHostLinux() {
+ if (window_handle_) {
+ base::MessagePumpAuraX11::Current()->RemoveDispatcherForWindow(
+ window_handle_);
+ }
+}
+
+void ForeignWindowHostLinux::SetDelegate(ForeignWindowHostDelegate* delegate) {
+ DCHECK(!delegate_);
+ delegate_ = delegate;
+}
+
+gfx::PluginWindowHandle ForeignWindowHostLinux::GetWindowHandle() const {
+ return window_handle_;
+}
+
+void ForeignWindowHostLinux::Close() {
+ DCHECK(window_handle_);
+ // TODO(reveman): Close managed window by sending a client message.
+}
+
+void ForeignWindowHostLinux::OnWindowDestroyed() {
+ DCHECK(window_handle_);
+ base::MessagePumpAuraX11::Current()->RemoveDispatcherForWindow(
+ window_handle_);
+ window_handle_ = 0;
+}
+
+bool ForeignWindowHostLinux::Dispatch(const base::NativeEvent& event) {
+ DCHECK(window_handle_);
+ // TODO(reveman): Only schedule repaint of the area that was damaged.
+ delegate_->OnWindowContentsChanged();
+ return true;
+}
+
+// static
+ForeignWindowHost* ForeignWindowHost::Create(
+ gfx::PluginWindowHandle window_handle) {
+ return new ForeignWindowHostLinux(window_handle);
+}
+
+} // namespace wm
« no previous file with comments | « wm/host/foreign_window_host_linux.h ('k') | wm/host/root_window_host_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698