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 "chrome/browser/ui/views/extensions/shell_window_views.h" | |
| 6 | |
| 7 #include "base/utf_string_conversions.h" | |
| 8 #include "chrome/browser/extensions/extension_host.h" | |
| 9 #include "chrome/common/extensions/extension.h" | |
| 10 #include "ui/views/widget/widget.h" | |
| 11 | |
| 12 ShellWindowViews::ShellWindowViews(ExtensionHost* host) | |
| 13 : ShellWindow(host) { | |
| 14 host_->view()->SetContainer(this); | |
| 15 window_ = new views::Widget; | |
| 16 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); | |
| 17 params.can_activate = true; | |
|
Ben Goodger (Google)
2012/01/12 23:53:57
This should be implied by TYPE_WINDOW.
jeremya
2012/01/12 23:58:51
Done.
| |
| 18 params.parent = NULL; | |
|
Ben Goodger (Google)
2012/01/12 23:53:57
default is NULL
jeremya
2012/01/12 23:58:51
Done.
| |
| 19 params.delegate = this; | |
| 20 gfx::Rect bounds(0, 0, 512, 384); | |
| 21 params.bounds = bounds; | |
| 22 params.top_level = true; | |
|
Ben Goodger (Google)
2012/01/12 23:53:57
I am not sure what this parameter does but I am pr
jeremya
2012/01/12 23:58:51
Done.
| |
| 23 window_->Init(params); | |
| 24 window_->Show(); | |
| 25 } | |
| 26 | |
| 27 ShellWindowViews::~ShellWindowViews() { | |
| 28 } | |
| 29 | |
| 30 void ShellWindowViews::Close() { | |
| 31 window_->Close(); | |
| 32 } | |
| 33 | |
| 34 void ShellWindowViews::DeleteDelegate() { | |
| 35 delete this; | |
| 36 } | |
| 37 | |
| 38 bool ShellWindowViews::CanResize() const { | |
| 39 return true; | |
| 40 } | |
| 41 | |
| 42 views::View* ShellWindowViews::GetContentsView() { | |
| 43 return host_->view(); | |
| 44 } | |
| 45 | |
| 46 string16 ShellWindowViews::GetWindowTitle() const { | |
| 47 return UTF8ToUTF16(host_->extension()->name()); | |
| 48 } | |
| 49 | |
| 50 views::Widget* ShellWindowViews::GetWidget() { | |
| 51 return window_; | |
| 52 } | |
| 53 | |
| 54 const views::Widget* ShellWindowViews::GetWidget() const { | |
| 55 return window_; | |
| 56 } | |
| 57 | |
| 58 // static | |
| 59 ShellWindow* ShellWindow::CreateShellWindow(ExtensionHost* host) { | |
| 60 return new ShellWindowViews(host); | |
| 61 } | |
| OLD | NEW |