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

Unified Diff: chrome/browser/ui/views/extensions/shell_window_views.cc

Issue 9030017: Implement ShellWindow in Views. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: comments Created 8 years, 11 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: chrome/browser/ui/views/extensions/shell_window_views.cc
diff --git a/chrome/browser/ui/views/extensions/shell_window_views.cc b/chrome/browser/ui/views/extensions/shell_window_views.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e1ee30bc862e2bf4c735e1d3fbefbc793b5c7b5e
--- /dev/null
+++ b/chrome/browser/ui/views/extensions/shell_window_views.cc
@@ -0,0 +1,61 @@
+// 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 "chrome/browser/ui/views/extensions/shell_window_views.h"
+
+#include "base/utf_string_conversions.h"
+#include "chrome/browser/extensions/extension_host.h"
+#include "chrome/common/extensions/extension.h"
+#include "ui/views/widget/widget.h"
+
+ShellWindowViews::ShellWindowViews(ExtensionHost* host)
+ : ShellWindow(host) {
+ host_->view()->SetContainer(this);
+ window_ = new views::Widget;
+ views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
+ 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.
+ params.parent = NULL;
Ben Goodger (Google) 2012/01/12 23:53:57 default is NULL
jeremya 2012/01/12 23:58:51 Done.
+ params.delegate = this;
+ gfx::Rect bounds(0, 0, 512, 384);
+ params.bounds = bounds;
+ 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.
+ window_->Init(params);
+ window_->Show();
+}
+
+ShellWindowViews::~ShellWindowViews() {
+}
+
+void ShellWindowViews::Close() {
+ window_->Close();
+}
+
+void ShellWindowViews::DeleteDelegate() {
+ delete this;
+}
+
+bool ShellWindowViews::CanResize() const {
+ return true;
+}
+
+views::View* ShellWindowViews::GetContentsView() {
+ return host_->view();
+}
+
+string16 ShellWindowViews::GetWindowTitle() const {
+ return UTF8ToUTF16(host_->extension()->name());
+}
+
+views::Widget* ShellWindowViews::GetWidget() {
+ return window_;
+}
+
+const views::Widget* ShellWindowViews::GetWidget() const {
+ return window_;
+}
+
+// static
+ShellWindow* ShellWindow::CreateShellWindow(ExtensionHost* host) {
+ return new ShellWindowViews(host);
+}

Powered by Google App Engine
This is Rietveld 408576698