Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "wm/foreign_window_widget.h" | |
| 6 | |
| 7 #include "ash/shell.h" | |
| 8 #include "ash/wm/property_util.h" | |
| 9 #include "ui/aura/root_window.h" | |
| 10 #include "ui/aura/window.h" | |
| 11 #include "ui/gfx/canvas.h" | |
| 12 #include "ui/views/widget/widget.h" | |
| 13 #include "ui/views/widget/widget_delegate.h" | |
| 14 #include "wm/foreign_window.h" | |
| 15 | |
| 16 namespace wm { | |
| 17 | |
| 18 ForeignWindowWidget::ForeignWindowWidget(ForeignWindow* window) | |
| 19 : window_(window) { | |
| 20 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); | |
| 21 params.delegate = window->CreateWidgetDelegate(); | |
| 22 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
| |
| 23 Init(params); | |
| 24 set_focus_on_creation(false); | |
| 25 GetNativeView()->SetName("ForeignWindowWidget"); | |
| 26 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
| |
| 27 GetNativeView(), | |
| 28 ash::WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES); | |
| 29 } | |
| 30 | |
| 31 ForeignWindowWidget::~ForeignWindowWidget() { | |
| 32 } | |
| 33 | |
| 34 void ForeignWindowWidget::Close() { | |
| 35 // Call base class Close() when native window has been destroyed. | |
| 36 if (window_->HasBeenDestroyed()) { | |
| 37 views::Widget::Close(); | |
| 38 return; | |
| 39 } | |
| 40 | |
| 41 window_->Close(); | |
| 42 } | |
| 43 | |
| 44 // static | |
| 45 views::Widget* ForeignWindowWidget::CreateWindow(ForeignWindow* window) { | |
| 46 return new ForeignWindowWidget(window); | |
| 47 } | |
| 48 | |
| 49 } // namespace wm | |
| OLD | NEW |