Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 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 "chrome/browser/ui/views/extensions/shell_window_views.h" | |
| 6 | |
| 7 #include "chrome/browser/extensions/extension_host.h" | |
| 8 #include "content/browser/renderer_host/render_widget_host_view_win.h" | |
| 9 #include "ui/views/widget/widget.h" | |
| 10 | |
| 11 ShellWindowViews::ShellWindowViews(ExtensionHost* host) | |
| 12 : ShellWindow(host) { | |
| 13 host_->view()->SetContainer(this); | |
| 14 window_ = new views::Widget; | |
| 15 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); | |
| 16 params.can_activate = true; | |
| 17 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | |
| 18 params.parent = NULL; | |
| 19 params.delegate = this; | |
| 20 gfx::Rect bounds(0, 0, 512, 384); | |
| 21 params.bounds = bounds; | |
| 22 params.top_level = true; | |
| 23 window_->Init(params); | |
| 24 window_->Show(); | |
| 25 } | |
| 26 | |
| 27 ShellWindowViews::~ShellWindowViews() { | |
| 28 } | |
| 29 | |
| 30 void ShellWindowViews::Close() { | |
| 31 delete window_; // TODO(jeremya): is this the right way to destroy a Widget? | |
| 32 delete this; | |
| 33 } | |
| 34 | |
| 35 views::View* ShellWindowViews::GetContentsView() { | |
| 36 return host_->view(); | |
| 37 } | |
| 38 | |
| 39 views::Widget* ShellWindowViews::GetWidget() { | |
| 40 return window_; | |
| 41 } | |
| 42 const views::Widget* ShellWindowViews::GetWidget() const { | |
| 43 return window_; | |
| 44 } | |
| 45 | |
| 46 // TODO(jeremya): destroy when window closes? | |
|
Mihai Parparita -not on Chrome
2012/01/06 23:26:50
I think you'll want to override DeleteDelegate and
jeremya
2012/01/12 01:46:04
Done.
| |
| OLD | NEW |