diff options
author | davemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-14 18:27:47 +0000 |
---|---|---|
committer | davemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-14 18:27:47 +0000 |
commit | a878ab3c10cf34f2fd3e9f98dea421670c51dc8b (patch) | |
tree | ab2c4bfe9a9c9560da67cce844430902902fc2e0 /ui/aura_shell | |
parent | ed724d405dbec47e85a4b53d2681d6e71a292f7a (diff) | |
download | chromium_src-a878ab3c10cf34f2fd3e9f98dea421670c51dc8b.zip chromium_src-a878ab3c10cf34f2fd3e9f98dea421670c51dc8b.tar.gz chromium_src-a878ab3c10cf34f2fd3e9f98dea421670c51dc8b.tar.bz2 |
Create a visible shelf and constrain window movement
BUG=106432
TEST=None
Review URL: http://codereview.chromium.org/8873036
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114459 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/aura_shell')
-rw-r--r-- | ui/aura_shell/launcher/launcher.cc | 5 | ||||
-rw-r--r-- | ui/aura_shell/launcher/launcher_view.cc | 28 | ||||
-rw-r--r-- | ui/aura_shell/shelf_layout_manager.cc | 2 | ||||
-rw-r--r-- | ui/aura_shell/toplevel_layout_manager.cc | 9 |
4 files changed, 38 insertions, 6 deletions
diff --git a/ui/aura_shell/launcher/launcher.cc b/ui/aura_shell/launcher/launcher.cc index 8b0ae38..7dddc94 100644 --- a/ui/aura_shell/launcher/launcher.cc +++ b/ui/aura_shell/launcher/launcher.cc @@ -24,9 +24,8 @@ Launcher::Launcher(aura::Window* window_container) widget_ = new views::Widget; views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL); - // All the content is drawn by the launcher buttons. Turn off the widget's - // layer's texture to avoid unnecessary memory use. - params.create_texture_for_layer = false; + params.create_texture_for_layer = true; + params.transparent = true; params.parent = Shell::GetInstance()->GetContainer( aura_shell::internal::kShellWindowId_LauncherContainer); internal::LauncherView* launcher_view = diff --git a/ui/aura_shell/launcher/launcher_view.cc b/ui/aura_shell/launcher/launcher_view.cc index 7847f77..7be436c 100644 --- a/ui/aura_shell/launcher/launcher_view.cc +++ b/ui/aura_shell/launcher/launcher_view.cc @@ -12,18 +12,21 @@ #include "ui/aura_shell/launcher/tabbed_launcher_button.h" #include "ui/aura_shell/launcher/view_model.h" #include "ui/aura_shell/launcher/view_model_utils.h" +#include "ui/aura_shell/shelf_layout_manager.h" #include "ui/aura_shell/shell.h" #include "ui/aura_shell/shell_delegate.h" #include "ui/base/animation/animation.h" #include "ui/base/animation/throb_animation.h" #include "ui/base/models/simple_menu_model.h" #include "ui/base/resource/resource_bundle.h" +#include "ui/gfx/canvas.h" #include "ui/gfx/compositor/layer.h" #include "ui/gfx/image/image.h" #include "ui/views/animation/bounds_animator.h" #include "ui/views/controls/button/image_button.h" #include "ui/views/controls/menu/menu_model_adapter.h" #include "ui/views/controls/menu/menu_runner.h" +#include "ui/views/painter.h" #include "ui/views/widget/widget.h" using ui::Animation; @@ -125,6 +128,25 @@ class FadeInAnimationDelegate : DISALLOW_COPY_AND_ASSIGN(FadeInAnimationDelegate); }; +// Used to draw the background of the shelf. +class ShelfPainter : public views::Painter { + public: + ShelfPainter() { + ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + image_ = *rb.GetImageNamed(IDR_AURA_LAUNCHER_BACKGROUND).ToSkBitmap(); + } + + virtual void Paint(int w, int h, gfx::Canvas* canvas) OVERRIDE { + canvas->TileImageInt(image_, 0, 0, w, h); + } + + private: + SkBitmap image_; + + DISALLOW_COPY_AND_ASSIGN(ShelfPainter); +}; + + } // namespace // AnimationDelegate used when inserting a new item. This steadily decreased the @@ -202,8 +224,12 @@ LauncherView::~LauncherView() { } void LauncherView::Init() { - model_->AddObserver(this); ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + model_->AddObserver(this); + + set_background( + views::Background::CreateBackgroundPainter(true, new ShelfPainter())); + new_browser_button_ = new views::ImageButton(this); int new_browser_button_image_id = Shell::GetInstance()->delegate()->GetResourceIDForNewBrowserWindow(); diff --git a/ui/aura_shell/shelf_layout_manager.cc b/ui/aura_shell/shelf_layout_manager.cc index c422aa7..d9f58e2 100644 --- a/ui/aura_shell/shelf_layout_manager.cc +++ b/ui/aura_shell/shelf_layout_manager.cc @@ -122,7 +122,7 @@ void ShelfLayoutManager::CalculateTargetBounds(bool visible, gfx::Rect launcher_bounds(launcher_->GetWindowScreenBounds()); target_bounds->launcher_bounds = gfx::Rect( available_bounds.x(), y + (max_height_ - launcher_bounds.height()) / 2, - available_bounds.width() - status_bounds.width(), + available_bounds.width(), launcher_bounds.height()); if (visible) target_bounds->work_area_insets = gfx::Insets(0, 0, max_height_, 0); diff --git a/ui/aura_shell/toplevel_layout_manager.cc b/ui/aura_shell/toplevel_layout_manager.cc index 05d5f47..00b44aa 100644 --- a/ui/aura_shell/toplevel_layout_manager.cc +++ b/ui/aura_shell/toplevel_layout_manager.cc @@ -48,7 +48,14 @@ void ToplevelLayoutManager::OnChildWindowVisibilityChanged(aura::Window* child, void ToplevelLayoutManager::SetChildBounds(aura::Window* child, const gfx::Rect& requested_bounds) { - SetChildBoundsDirect(child, requested_bounds); + const static int kTitleHeight = 12; + gfx::Rect child_bounds(requested_bounds); + gfx::Rect work_area = gfx::Screen::GetMonitorWorkAreaNearestWindow(child); + if (child_bounds.y() < 0) + child_bounds.set_y(0); + else if (child_bounds.y() + kTitleHeight > work_area.bottom()) + child_bounds.set_y(work_area.bottom() - kTitleHeight); + SetChildBoundsDirect(child, child_bounds); } void ToplevelLayoutManager::OnWindowPropertyChanged(aura::Window* window, |