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

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: 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/foreign_window_widget.h ('k') | wm/gpu/DEPS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..8050d9842f90307f80c0976deb87deb842dd27e7
--- /dev/null
+++ b/wm/foreign_window_widget.cc
@@ -0,0 +1,51 @@
+// 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/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* foreign_window)
+ : foreign_window_(foreign_window) {
+ views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
+ params.delegate = foreign_window->CreateWidgetDelegate();
+ // TODO(reveman): Add support for multiple root windows.
+ params.context = ash::Shell::GetAllRootWindows()[0];
+ Init(params);
+ set_focus_on_creation(false);
+ GetNativeView()->SetName("ForeignWindowWidget");
+ SetPersistsAcrossAllWorkspaces(
+ 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 (foreign_window_->HasBeenDestroyed()) {
+ views::Widget::Close();
+ return;
+ }
+
+ foreign_window_->Close();
+}
+
+// static
+views::Widget* ForeignWindowWidget::CreateWindow(
+ ForeignWindow* foreign_window) {
+ return new ForeignWindowWidget(foreign_window);
+}
+
+} // namespace wm
« no previous file with comments | « wm/foreign_window_widget.h ('k') | wm/gpu/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698