From 6de3a01154a0ffbe273da08ce6c67164d71b18d7 Mon Sep 17 00:00:00 2001 From: "tbreisacher@chromium.org" Date: Sat, 4 Feb 2012 03:57:50 +0000 Subject: Revert 120460 - Add PanelWindow and PanelLayoutManager to ash. This implements a sample implementation of a WidgetDelegateView (PanelWindow) and a LayoutManager to provide an initial outline for developing panels. ash_shell must be run with --aura-panels to get the new behavior, since Chrome currently relies on existing behavior for widgets of TYPE_PANEL. BUG=98330 TEST=Run ash_shell --aura-panels to see a simple panel test implementation. Ensure panels work as expected in Chrome. Review URL: http://codereview.chromium.org/9104027 TBR=stevenjb@chromium.org Review URL: https://chromiumcodereview.appspot.com/9328026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@120465 0039d316-1c4b-4281-b951-d872f2087c98 --- ash/shell/panel_window.cc | 84 ----------------------------------------------- 1 file changed, 84 deletions(-) delete mode 100644 ash/shell/panel_window.cc (limited to 'ash/shell/panel_window.cc') diff --git a/ash/shell/panel_window.cc b/ash/shell/panel_window.cc deleted file mode 100644 index 5cfaffa..0000000 --- a/ash/shell/panel_window.cc +++ /dev/null @@ -1,84 +0,0 @@ -// 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 "ash/shell/panel_window.h" - -#include "ash/wm/toplevel_frame_view.h" -#include "base/utf_string_conversions.h" -#include "ui/aura/window.h" -#include "ui/gfx/canvas.h" -#include "ui/views/widget/widget.h" - -namespace { -const int kMinWidth = 100; -const int kMinHeight = 100; -const int kDefaultWidth = 200; -const int kDefaultHeight = 300; -} - -namespace ash { - -// static -views::Widget* PanelWindow::CreatePanelWindow(const gfx::Rect& rect) { - PanelWindow* panel_window = new PanelWindow("Example Panel Window"); - panel_window->params().bounds = rect; - return panel_window->CreateWidget(); -} - -PanelWindow::PanelWindow(const std::string& name) - : name_(name), - params_(views::Widget::InitParams::TYPE_PANEL) { - params_.delegate = this; -} - -PanelWindow::~PanelWindow() { -} - -views::Widget* PanelWindow::CreateWidget() { - views::Widget* widget = new views::Widget; - - if (params().bounds.width() == 0) - params().bounds.set_width(kDefaultWidth); - if (params().bounds.height() == 0) - params().bounds.set_height(kDefaultHeight); - - widget->Init(params()); - widget->GetNativeView()->SetName(name_); - widget->Show(); - - return widget; -} - -gfx::Size PanelWindow::GetPreferredSize() { - return gfx::Size(kMinWidth, kMinHeight); -} - -void PanelWindow::OnPaint(gfx::Canvas* canvas) { - canvas->FillRect(GetLocalBounds(), SK_ColorGREEN); -} - -string16 PanelWindow::GetWindowTitle() const { - return ASCIIToUTF16(name_); -} - -views::View* PanelWindow::GetContentsView() { - return this; -} - -bool PanelWindow::CanResize() const { - return true; -} - -bool PanelWindow::CanMaximize() const { - return false; -} - -views::NonClientFrameView* PanelWindow::CreateNonClientFrameView() { - // TODO(stevenjb): Implement a custom frame view for panels. - // For now, use the default frame view (views::CustomFrameView) - // which implements close and resize for us. - return NULL; -} - -} // namespace ash -- cgit v1.1