summaryrefslogtreecommitdiffstats
path: root/ash/shell
diff options
context:
space:
mode:
authortbreisacher@chromium.org <tbreisacher@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-04 03:57:50 +0000
committertbreisacher@chromium.org <tbreisacher@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-04 03:57:50 +0000
commit6de3a01154a0ffbe273da08ce6c67164d71b18d7 (patch)
tree88d226f502c045295e98df3137d92e3e07ed931f /ash/shell
parenteb8abacb3842302263f3d3bd6f875d25273eb991 (diff)
downloadchromium_src-6de3a01154a0ffbe273da08ce6c67164d71b18d7.zip
chromium_src-6de3a01154a0ffbe273da08ce6c67164d71b18d7.tar.gz
chromium_src-6de3a01154a0ffbe273da08ce6c67164d71b18d7.tar.bz2
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
Diffstat (limited to 'ash/shell')
-rw-r--r--ash/shell/panel_window.cc84
-rw-r--r--ash/shell/panel_window.h53
-rw-r--r--ash/shell/window_type_launcher.cc13
-rw-r--r--ash/shell/window_type_launcher.h1
4 files changed, 1 insertions, 150 deletions
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
diff --git a/ash/shell/panel_window.h b/ash/shell/panel_window.h
deleted file mode 100644
index cc1afbd..0000000
--- a/ash/shell/panel_window.h
+++ /dev/null
@@ -1,53 +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.
-
-#ifndef ASH_SHELL_PANEL_WINDOW_H_
-#define ASH_SHELL_PANEL_WINDOW_H_
-#pragma once
-
-#include "base/basictypes.h"
-#include "ui/aura/aura_export.h"
-#include "ui/views/widget/widget.h"
-#include "ui/views/widget/widget_delegate.h"
-
-namespace ash {
-
-// Example Class for panel windows (Widget::InitParams::TYPE_PANEL).
-// Instances of PanelWindow will get added to the PanelContainer top level
-// window which manages the panel layout through PanelLayoutManager.
-class PanelWindow : public views::WidgetDelegateView {
- public:
- explicit PanelWindow(const std::string& name);
- virtual ~PanelWindow();
-
- // Creates the widget for the panel window using |params_|.
- views::Widget* CreateWidget();
-
- const std::string& name() { return name_; }
- views::Widget::InitParams& params() { return params_; }
-
- // Creates a panel window and returns the associated widget.
- static views::Widget* CreatePanelWindow(const gfx::Rect& rect);
-
- private:
- // Overridden from views::View:
- virtual gfx::Size GetPreferredSize() OVERRIDE;
- virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
-
- // Overridden from views::WidgetDelegate:
- virtual string16 GetWindowTitle() const OVERRIDE;
- virtual View* GetContentsView() OVERRIDE;
- virtual bool CanResize() const OVERRIDE;
- virtual bool CanMaximize() const OVERRIDE;
- virtual views::NonClientFrameView* CreateNonClientFrameView() OVERRIDE;
-
- std::string name_;
- views::Widget::InitParams params_;
-
- DISALLOW_COPY_AND_ASSIGN(PanelWindow);
-};
-
-} // namespace ash
-
-#endif // ASH_SHELL_PANEL_WINDOW_H_
diff --git a/ash/shell/window_type_launcher.cc b/ash/shell/window_type_launcher.cc
index 0153d1c..42f5db1 100644
--- a/ash/shell/window_type_launcher.cc
+++ b/ash/shell/window_type_launcher.cc
@@ -6,7 +6,6 @@
#include "ash/shell_window_ids.h"
#include "ash/shell/example_factory.h"
-#include "ash/shell/panel_window.h"
#include "ash/shell/toplevel_window.h"
#include "ash/wm/shadow_types.h"
#include "ash/wm/toplevel_frame_view.h"
@@ -178,8 +177,6 @@ void InitWindowTypeLauncher() {
WindowTypeLauncher::WindowTypeLauncher()
: ALLOW_THIS_IN_INITIALIZER_LIST(create_button_(
new views::NativeTextButton(this, ASCIIToUTF16("Create Window")))),
- ALLOW_THIS_IN_INITIALIZER_LIST(panel_button_(
- new views::NativeTextButton(this, ASCIIToUTF16("Create Panel")))),
ALLOW_THIS_IN_INITIALIZER_LIST(create_nonresizable_button_(
new views::NativeTextButton(
this, ASCIIToUTF16("Create Non-Resizable Window")))),
@@ -207,7 +204,6 @@ WindowTypeLauncher::WindowTypeLauncher()
new views::NativeTextButton(
this, ASCIIToUTF16("Show/Hide a Window")))) {
AddChildView(create_button_);
- AddChildView(panel_button_);
AddChildView(create_nonresizable_button_);
AddChildView(bubble_button_);
AddChildView(lock_button_);
@@ -236,14 +232,9 @@ void WindowTypeLauncher::Layout() {
5, local_bounds.bottom() - create_button_ps.height() - 5,
create_button_ps.width(), create_button_ps.height());
- gfx::Size panel_button_ps = panel_button_->GetPreferredSize();
- panel_button_->SetBounds(
- 5, create_button_->y() - panel_button_ps.height() - 5,
- panel_button_ps.width(), panel_button_ps.height());
-
gfx::Size bubble_button_ps = bubble_button_->GetPreferredSize();
bubble_button_->SetBounds(
- 5, panel_button_->y() - bubble_button_ps.height() - 5,
+ 5, create_button_->y() - bubble_button_ps.height() - 5,
bubble_button_ps.width(), bubble_button_ps.height());
gfx::Size create_nr_button_ps =
@@ -316,8 +307,6 @@ void WindowTypeLauncher::ButtonPressed(views::Button* sender,
ToplevelWindow::CreateParams params;
params.can_resize = true;
ToplevelWindow::CreateToplevelWindow(params);
- } else if (sender == panel_button_) {
- PanelWindow::CreatePanelWindow(gfx::Rect());
} else if (sender == create_nonresizable_button_) {
ToplevelWindow::CreateToplevelWindow(ToplevelWindow::CreateParams());
} else if (sender == bubble_button_) {
diff --git a/ash/shell/window_type_launcher.h b/ash/shell/window_type_launcher.h
index afaaf52..3dbe197 100644
--- a/ash/shell/window_type_launcher.h
+++ b/ash/shell/window_type_launcher.h
@@ -68,7 +68,6 @@ class WindowTypeLauncher : public views::WidgetDelegateView,
#endif // !defined(OS_MACOSX)
views::NativeTextButton* create_button_;
- views::NativeTextButton* panel_button_;
views::NativeTextButton* create_nonresizable_button_;
views::NativeTextButton* bubble_button_;
views::NativeTextButton* lock_button_;