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

Unified Diff: wm/foreign_window_widget.cc

Issue 11485006: Add window manager component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase and add proper use_wm flag support 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
Index: wm/foreign_window_widget.cc
diff --git a/wm/foreign_window_widget.cc b/wm/foreign_window_widget.cc
new file mode 100644
index 0000000000000000000000000000000000000000..417bc3bda2a3d163d1084729f5ba8fcf129de9ec
--- /dev/null
+++ b/wm/foreign_window_widget.cc
@@ -0,0 +1,49 @@
+// Copyright (c) 2012 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/foreign_window_widget.h"
+
+#include "ash/shell.h"
+#include "ash/wm/property_util.h"
+#include "ui/aura/root_window.h"
+#include "ui/aura/window.h"
+#include "ui/gfx/canvas.h"
+#include "ui/views/widget/widget.h"
+#include "ui/views/widget/widget_delegate.h"
+#include "wm/foreign_window.h"
+
+namespace wm {
+
+ForeignWindowWidget::ForeignWindowWidget(ForeignWindow* window)
+ : window_(window) {
+ views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
+ params.delegate = window->CreateWidgetDelegate();
+ params.context = ash::Shell::GetAllRootWindows()[0];
danakj 2013/02/21 01:33:15 this is going to break on dual-head isn't it? shal
reveman 2013/02/22 01:26:44 Yes, last time I touched this code ash::Shell::Get
+ Init(params);
+ set_focus_on_creation(false);
+ GetNativeView()->SetName("ForeignWindowWidget");
+ SetPersistsAcrossAllWorkspaces(
danakj 2013/02/21 01:33:15 curious, what happens if we don't set persists acr
reveman 2013/02/22 01:26:44 you probably get parts of the screen where input d
+ GetNativeView(),
+ ash::WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES);
+}
+
+ForeignWindowWidget::~ForeignWindowWidget() {
+}
+
+void ForeignWindowWidget::Close() {
+ // Call base class Close() when native window has been destroyed.
+ if (window_->HasBeenDestroyed()) {
+ views::Widget::Close();
+ return;
+ }
+
+ window_->Close();
+}
+
+// static
+views::Widget* ForeignWindowWidget::CreateWindow(ForeignWindow* window) {
+ return new ForeignWindowWidget(window);
+}
+
+} // namespace wm

Powered by Google App Engine
This is Rietveld 408576698