diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-14 22:15:16 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-14 22:15:16 +0000 |
commit | a3469db484c2b23b4fccd8af2e8cce8692749dc0 (patch) | |
tree | 7841ddf4c47bad4574161a284cbc3ca3ef1a66ec | |
parent | f081395e06004d74846b632a6151af2317b0234b (diff) | |
download | chromium_src-a3469db484c2b23b4fccd8af2e8cce8692749dc0.zip chromium_src-a3469db484c2b23b4fccd8af2e8cce8692749dc0.tar.gz chromium_src-a3469db484c2b23b4fccd8af2e8cce8692749dc0.tar.bz2 |
Relands fixes for 106432, 107287 and 107401. These got reverted
together, so I'm relanding together. Here's the original descriptions:
Fixes layout bugs in ShelfLayoutManager. The problem with invoking
SetBounds on the widget during the animation is we end up back in the
layoutmanager and cancel the change. Also adds some tests for
ShelfLayoutManager.
and
Create a visible shelf and constrain window movement
This also includes the fix, which you reviewed @
http://codereview.chromium.org/8914012 .
BUG=106432 107287 107401
TEST=none
TBR=ben@chromium.org
Review URL: http://codereview.chromium.org/8914023
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114502 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/ui/views/aura/chrome_shell_delegate.cc | 5 | ||||
-rw-r--r-- | chrome/browser/ui/views/aura/chrome_shell_delegate.h | 1 | ||||
-rw-r--r-- | ui/aura_shell/examples/aura_shell_main.cc | 5 | ||||
-rw-r--r-- | ui/aura_shell/launcher/launcher.cc | 5 | ||||
-rw-r--r-- | ui/aura_shell/launcher/launcher_view.cc | 99 | ||||
-rw-r--r-- | ui/aura_shell/launcher/tabbed_launcher_button.cc | 72 | ||||
-rw-r--r-- | ui/aura_shell/launcher/tabbed_launcher_button.h | 23 | ||||
-rw-r--r-- | ui/aura_shell/shelf_layout_manager.cc | 2 | ||||
-rw-r--r-- | ui/aura_shell/shell_delegate.h | 5 | ||||
-rw-r--r-- | ui/aura_shell/test/test_shell_delegate.cc | 6 | ||||
-rw-r--r-- | ui/aura_shell/test/test_shell_delegate.h | 1 | ||||
-rw-r--r-- | ui/aura_shell/toplevel_layout_manager.cc | 9 | ||||
-rw-r--r-- | ui/resources/aura/launcher_background.png | bin | 0 -> 2575 bytes | |||
-rw-r--r-- | ui/resources/ui_resources.grd | 1 |
14 files changed, 142 insertions, 92 deletions
diff --git a/chrome/browser/ui/views/aura/chrome_shell_delegate.cc b/chrome/browser/ui/views/aura/chrome_shell_delegate.cc index fdfee85..631c752 100644 --- a/chrome/browser/ui/views/aura/chrome_shell_delegate.cc +++ b/chrome/browser/ui/views/aura/chrome_shell_delegate.cc @@ -9,6 +9,7 @@ #include "chrome/browser/ui/views/aura/app_list_window.h" #include "chrome/browser/ui/views/aura/status_area_host_aura.h" #include "chrome/browser/ui/views/frame/browser_view.h" +#include "grit/theme_resources.h" #include "ui/aura/window.h" #include "ui/aura_shell/launcher/launcher_types.h" #include "ui/aura_shell/window_util.h" @@ -76,3 +77,7 @@ bool ChromeShellDelegate::ConfigureLauncherItem( return view && ShouldCreateLauncherItemForBrowser(view->browser(), &(item->type)); } + +int ChromeShellDelegate::GetResourceIDForNewBrowserWindow() { + return IDR_PRODUCT_LOGO_32; +} diff --git a/chrome/browser/ui/views/aura/chrome_shell_delegate.h b/chrome/browser/ui/views/aura/chrome_shell_delegate.h index a524f30..eb355d3 100644 --- a/chrome/browser/ui/views/aura/chrome_shell_delegate.h +++ b/chrome/browser/ui/views/aura/chrome_shell_delegate.h @@ -44,6 +44,7 @@ class ChromeShellDelegate : public aura_shell::ShellDelegate { virtual void LauncherItemClicked( const aura_shell::LauncherItem& item) OVERRIDE; virtual bool ConfigureLauncherItem(aura_shell::LauncherItem* item) OVERRIDE; + virtual int GetResourceIDForNewBrowserWindow() OVERRIDE; private: static ChromeShellDelegate* instance_; diff --git a/ui/aura_shell/examples/aura_shell_main.cc b/ui/aura_shell/examples/aura_shell_main.cc index 0700047..93363a8 100644 --- a/ui/aura_shell/examples/aura_shell_main.cc +++ b/ui/aura_shell/examples/aura_shell_main.cc @@ -7,6 +7,7 @@ #include "base/i18n/icu_util.h" #include "base/memory/scoped_ptr.h" #include "base/message_loop.h" +#include "grit/ui_resources.h" #include "ui/aura/root_window.h" #include "ui/aura_shell/examples/toplevel_window.h" #include "ui/aura_shell/launcher/launcher_types.h" @@ -92,6 +93,10 @@ class ShellDelegateImpl : public aura_shell::ShellDelegate { image_count = (image_count + 1) % 3; return true; // Makes the entry show up in the launcher. } + + virtual int GetResourceIDForNewBrowserWindow() OVERRIDE { + return IDR_AURA_LAUNCHER_ICON_CHROME; + } }; } // namespace 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 0cba08b..4d7c0f2 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; @@ -82,48 +85,6 @@ class MenuDelegateImpl : public ui::SimpleMenuModel::Delegate { DISALLOW_COPY_AND_ASSIGN(MenuDelegateImpl); }; -// ImageButton subclass that animates transition changes using the opacity of -// the layer. -class FadeButton : public views::ImageButton { - public: - explicit FadeButton(views::ButtonListener* listener) - : ImageButton(listener) { - SetPaintToLayer(true); - layer()->SetFillsBoundsOpaquely(false); - layer()->SetOpacity(kDimmedButtonOpacity); - } - - protected: - // ImageButton overrides: - virtual SkBitmap GetImageToPaint() OVERRIDE { - // ImageButton::GetImageToPaint returns an alpha blended image based on - // hover_animation_. FadeButton uses hover_animation to change the opacity - // of the layer, so this can be overriden to return the normal image always. - return images_[BS_NORMAL]; - } - virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE { - layer()->SetOpacity(kDimmedButtonOpacity + (1.0f - kDimmedButtonOpacity) * - animation->GetCurrentValue()); - layer()->ScheduleDraw(); - } - virtual void StateChanged() OVERRIDE { - if (!hover_animation_->is_animating()) { - float opacity = state_ == BS_NORMAL ? kDimmedButtonOpacity : 1.0f; - if (layer()->opacity() != opacity) { - layer()->SetOpacity(opacity); - layer()->ScheduleDraw(); - } - } - } - virtual void SchedulePaint() OVERRIDE { - // All changes we care about trigger a draw on the layer, so this can be - // overriden to do nothing. - } - - private: - DISALLOW_COPY_AND_ASSIGN(FadeButton); -}; - // AnimationDelegate that deletes a view when done. This is used when a launcher // item is removed, which triggers a remove animation. When the animation is // done we delete the view. @@ -167,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 @@ -244,12 +224,20 @@ LauncherView::~LauncherView() { } void LauncherView::Init() { - model_->AddObserver(this); ResourceBundle& rb = ResourceBundle::GetSharedInstance(); - new_browser_button_ = new FadeButton(this); + model_->AddObserver(this); + + set_background( + views::Background::CreateBackgroundPainter(true, new ShelfPainter())); + + new_browser_button_ = new views::ImageButton(this); + ShellDelegate* delegate = Shell::GetInstance()->delegate(); + int new_browser_button_image_id = delegate ? + delegate->GetResourceIDForNewBrowserWindow() : + IDR_AURA_LAUNCHER_ICON_CHROME; new_browser_button_->SetImage( views::CustomButton::BS_NORMAL, - rb.GetImageNamed(IDR_AURA_LAUNCHER_ICON_CHROME).ToSkBitmap()); + rb.GetImageNamed(new_browser_button_image_id).ToSkBitmap()); ConfigureChildView(new_browser_button_); AddChildView(new_browser_button_); @@ -261,18 +249,29 @@ void LauncherView::Init() { AddChildView(child); } - show_apps_button_ = new FadeButton(this); + show_apps_button_ = new views::ImageButton(this); show_apps_button_->SetImage( views::CustomButton::BS_NORMAL, rb.GetImageNamed(IDR_AURA_LAUNCHER_ICON_APPLIST).ToSkBitmap()); + show_apps_button_->SetImage( + views::CustomButton::BS_HOT, + rb.GetImageNamed(IDR_AURA_LAUNCHER_ICON_APPLIST_HOT).ToSkBitmap()); + show_apps_button_->SetImage( + views::CustomButton::BS_PUSHED, + rb.GetImageNamed(IDR_AURA_LAUNCHER_ICON_APPLIST_PUSHED).ToSkBitmap()); ConfigureChildView(show_apps_button_); AddChildView(show_apps_button_); - overflow_button_ = new FadeButton(this); - // TODO: need image for this. + overflow_button_ = new views::ImageButton(this); overflow_button_->SetImage( views::CustomButton::BS_NORMAL, rb.GetImageNamed(IDR_AURA_LAUNCHER_OVERFLOW).ToSkBitmap()); + overflow_button_->SetImage( + views::CustomButton::BS_HOT, + rb.GetImageNamed(IDR_AURA_LAUNCHER_OVERFLOW_HOT).ToSkBitmap()); + overflow_button_->SetImage( + views::CustomButton::BS_PUSHED, + rb.GetImageNamed(IDR_AURA_LAUNCHER_OVERFLOW_PUSHED).ToSkBitmap()); ConfigureChildView(overflow_button_); AddChildView(overflow_button_); @@ -336,8 +335,8 @@ void LauncherView::CalculateIdealBounds(IdealBounds* bounds) { (kPreferredHeight - bounds->overflow_bounds.height()) / 2); x = bounds->overflow_bounds.right() + kHorizontalPadding; } - // TODO(sky): -8 is a hack, remove when we get better images. - bounds->show_apps_bounds.set_x(x - 8); + // TODO(sky): -6 is a hack, remove when we get better images. + bounds->show_apps_bounds.set_x(x - 6); bounds->show_apps_bounds.set_y( (kPreferredHeight - bounds->show_apps_bounds.height()) / 2); } diff --git a/ui/aura_shell/launcher/tabbed_launcher_button.cc b/ui/aura_shell/launcher/tabbed_launcher_button.cc index f1a1e27..aac9205 100644 --- a/ui/aura_shell/launcher/tabbed_launcher_button.cc +++ b/ui/aura_shell/launcher/tabbed_launcher_button.cc @@ -32,23 +32,27 @@ const int kBgBottomInset = 12; const int kBgRightInset = 8; // static -SkBitmap* TabbedLauncherButton::bg_image_1_ = NULL; -SkBitmap* TabbedLauncherButton::bg_image_2_ = NULL; -SkBitmap* TabbedLauncherButton::bg_image_3_ = NULL; +TabbedLauncherButton::ImageSet* TabbedLauncherButton::bg_image_1_ = NULL; +TabbedLauncherButton::ImageSet* TabbedLauncherButton::bg_image_2_ = NULL; +TabbedLauncherButton::ImageSet* TabbedLauncherButton::bg_image_3_ = NULL; TabbedLauncherButton::TabbedLauncherButton(views::ButtonListener* listener, LauncherButtonHost* host) - : views::CustomButton(listener), + : views::ImageButton(listener), host_(host) { if (!bg_image_1_) { - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); - bg_image_1_ = new SkBitmap( - *rb.GetImageNamed(IDR_AURA_LAUNCHER_TABBED_BROWSER_1).ToSkBitmap()); - bg_image_2_ = new SkBitmap( - *rb.GetImageNamed(IDR_AURA_LAUNCHER_TABBED_BROWSER_2).ToSkBitmap()); - bg_image_3_ = new SkBitmap( - *rb.GetImageNamed(IDR_AURA_LAUNCHER_TABBED_BROWSER_3).ToSkBitmap()); + bg_image_1_ = CreateImageSet(IDR_AURA_LAUNCHER_TABBED_BROWSER_1, + IDR_AURA_LAUNCHER_TABBED_BROWSER_1_PUSHED, + IDR_AURA_LAUNCHER_TABBED_BROWSER_1_HOT); + bg_image_2_ = CreateImageSet(IDR_AURA_LAUNCHER_TABBED_BROWSER_2, + IDR_AURA_LAUNCHER_TABBED_BROWSER_2_PUSHED, + IDR_AURA_LAUNCHER_TABBED_BROWSER_2_HOT); + bg_image_3_ = CreateImageSet(IDR_AURA_LAUNCHER_TABBED_BROWSER_3, + IDR_AURA_LAUNCHER_TABBED_BROWSER_3_PUSHED, + IDR_AURA_LAUNCHER_TABBED_BROWSER_3_HOT); } + SetImageAlignment(views::ImageButton::ALIGN_CENTER, + views::ImageButton::ALIGN_MIDDLE); } TabbedLauncherButton::~TabbedLauncherButton() { @@ -56,21 +60,20 @@ TabbedLauncherButton::~TabbedLauncherButton() { void TabbedLauncherButton::SetImages(const LauncherTabbedImages& images) { images_ = images; -} - -gfx::Size TabbedLauncherButton::GetPreferredSize() { - return gfx::Size(bg_image_1_->width(), bg_image_1_->height()); -} - -void TabbedLauncherButton::OnPaint(gfx::Canvas* canvas) { - SkBitmap* bg_image = NULL; + ImageSet* set; if (images_.size() <= 1) - bg_image = bg_image_1_; + set = bg_image_1_; else if (images_.size() == 2) - bg_image = bg_image_2_; + set = bg_image_2_; else - bg_image = bg_image_3_; - canvas->DrawBitmapInt(*bg_image, 0, 0); + set = bg_image_3_; + SetImage(BS_NORMAL, set->normal_image); + SetImage(BS_HOT, set->hot_image); + SetImage(BS_PUSHED, set->pushed_image); +} + +void TabbedLauncherButton::OnPaint(gfx::Canvas* canvas) { + ImageButton::OnPaint(canvas); if (images_.empty()) return; @@ -79,31 +82,44 @@ void TabbedLauncherButton::OnPaint(gfx::Canvas* canvas) { // TODO(sky): if we settle on just 1 icon, then we should simplify surrounding // code (don't use a vector of images). int x = (width() - images_[0].image.width()) / 2; - int y = (height() - images_[0].image.height()) / 2; + int y = (height() - images_[0].image.height()) / 2 + 1; canvas->DrawBitmapInt(images_[0].image, x, y); } bool TabbedLauncherButton::OnMousePressed(const views::MouseEvent& event) { - CustomButton::OnMousePressed(event); + ImageButton::OnMousePressed(event); host_->MousePressedOnButton(this, event); return true; } void TabbedLauncherButton::OnMouseReleased(const views::MouseEvent& event) { host_->MouseReleasedOnButton(this, false); - CustomButton::OnMouseReleased(event); + ImageButton::OnMouseReleased(event); } void TabbedLauncherButton::OnMouseCaptureLost() { host_->MouseReleasedOnButton(this, true); - CustomButton::OnMouseCaptureLost(); + ImageButton::OnMouseCaptureLost(); } bool TabbedLauncherButton::OnMouseDragged(const views::MouseEvent& event) { - CustomButton::OnMouseDragged(event); + ImageButton::OnMouseDragged(event); host_->MouseDraggedOnButton(this, event); return true; } +// static +TabbedLauncherButton::ImageSet* TabbedLauncherButton::CreateImageSet( + int normal_id, + int pushed_id, + int hot_id) { + ImageSet* set = new ImageSet; + ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + set->normal_image = new SkBitmap(*rb.GetImageNamed(normal_id).ToSkBitmap()); + set->pushed_image = new SkBitmap(*rb.GetImageNamed(pushed_id).ToSkBitmap()); + set->hot_image = new SkBitmap(*rb.GetImageNamed(hot_id).ToSkBitmap()); + return set; +} + } // namespace internal } // namespace aura_shell diff --git a/ui/aura_shell/launcher/tabbed_launcher_button.h b/ui/aura_shell/launcher/tabbed_launcher_button.h index 5534e1f..a945074 100644 --- a/ui/aura_shell/launcher/tabbed_launcher_button.h +++ b/ui/aura_shell/launcher/tabbed_launcher_button.h @@ -7,7 +7,7 @@ #pragma once #include "ui/aura_shell/launcher/launcher_types.h" -#include "ui/views/controls/button/custom_button.h" +#include "ui/views/controls/button/image_button.h" namespace aura_shell { namespace internal { @@ -15,7 +15,7 @@ namespace internal { class LauncherButtonHost; // Button used for items on the launcher corresponding to tabbed windows. -class TabbedLauncherButton : public views::CustomButton { +class TabbedLauncherButton : public views::ImageButton { public: TabbedLauncherButton(views::ButtonListener* listener, LauncherButtonHost* host); @@ -24,9 +24,6 @@ class TabbedLauncherButton : public views::CustomButton { // Sets the images to display for this entry. void SetImages(const LauncherTabbedImages& images); - // View overrides: - virtual gfx::Size GetPreferredSize() OVERRIDE; - protected: // View overrides: virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; @@ -36,15 +33,25 @@ class TabbedLauncherButton : public views::CustomButton { virtual bool OnMouseDragged(const views::MouseEvent& event) OVERRIDE; private: + struct ImageSet { + SkBitmap* normal_image; + SkBitmap* pushed_image; + SkBitmap* hot_image; + }; + + // Creates an ImageSet using the specified image ids. Caller owns the returned + // value. + static ImageSet* CreateImageSet(int normal_id, int pushed_id, int hot_id); + LauncherTabbedImages images_; LauncherButtonHost* host_; // Background images. Which one is chosen depends upon how many images are // provided. - static SkBitmap* bg_image_1_; - static SkBitmap* bg_image_2_; - static SkBitmap* bg_image_3_; + static ImageSet* bg_image_1_; + static ImageSet* bg_image_2_; + static ImageSet* bg_image_3_; DISALLOW_COPY_AND_ASSIGN(TabbedLauncherButton); }; 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/shell_delegate.h b/ui/aura_shell/shell_delegate.h index 3771b1a..1239bc8 100644 --- a/ui/aura_shell/shell_delegate.h +++ b/ui/aura_shell/shell_delegate.h @@ -50,8 +50,11 @@ class AURA_SHELL_EXPORT ShellDelegate { // an entry for |item->window| it should configure |item| appropriately and // return true. virtual bool ConfigureLauncherItem(LauncherItem* item) = 0; -}; + // Returns the resource id of the image to show on the button that creates a + // new browser window. + virtual int GetResourceIDForNewBrowserWindow() = 0; +}; } // namespace aura_shell #endif // UI_AURA_SHELL_SHELL_DELEGATE_H_ diff --git a/ui/aura_shell/test/test_shell_delegate.cc b/ui/aura_shell/test/test_shell_delegate.cc index 42414b7..98057f9 100644 --- a/ui/aura_shell/test/test_shell_delegate.cc +++ b/ui/aura_shell/test/test_shell_delegate.cc @@ -4,6 +4,8 @@ #include "ui/aura_shell/test/test_shell_delegate.h" +#include "grit/ui_resources.h" + namespace aura_shell { namespace test { @@ -32,5 +34,9 @@ bool TestShellDelegate::ConfigureLauncherItem(LauncherItem* item) { return true; } +int TestShellDelegate::GetResourceIDForNewBrowserWindow() { + return IDR_AURA_LAUNCHER_ICON_CHROME; +} + } // namespace test } // namespace aura_shell diff --git a/ui/aura_shell/test/test_shell_delegate.h b/ui/aura_shell/test/test_shell_delegate.h index 6811d45..91a55b4 100644 --- a/ui/aura_shell/test/test_shell_delegate.h +++ b/ui/aura_shell/test/test_shell_delegate.h @@ -25,6 +25,7 @@ class TestShellDelegate : public ShellDelegate { const SetWidgetCallback& callback) OVERRIDE; virtual void LauncherItemClicked(const LauncherItem& item) OVERRIDE; virtual bool ConfigureLauncherItem(LauncherItem* item) OVERRIDE; + virtual int GetResourceIDForNewBrowserWindow() OVERRIDE; }; } // namespace test 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, diff --git a/ui/resources/aura/launcher_background.png b/ui/resources/aura/launcher_background.png Binary files differnew file mode 100644 index 0000000..05626ab --- /dev/null +++ b/ui/resources/aura/launcher_background.png diff --git a/ui/resources/ui_resources.grd b/ui/resources/ui_resources.grd index 1997752..a67f53e 100644 --- a/ui/resources/ui_resources.grd +++ b/ui/resources/ui_resources.grd @@ -149,6 +149,7 @@ <include name="IDR_AURA_LAUNCHER_ICON_APPLIST" file="aura/applist.png" type="BINDATA" /> <include name="IDR_AURA_LAUNCHER_ICON_APPLIST_HOT" file="aura/applist_h.png" type="BINDATA" /> <include name="IDR_AURA_LAUNCHER_ICON_APPLIST_PUSHED" file="aura/applist_p.png" type="BINDATA" /> + <include name="IDR_AURA_LAUNCHER_BACKGROUND" file="aura/launcher_background.png" type="BINDATA" /> <include name="IDR_AURA_SHADOW_RECT_TOP_LEFT" file="aura/shadow_rect_top_left.png" type="BINDATA" /> <include name="IDR_AURA_SHADOW_RECT_TOP" file="aura/shadow_rect_top.png" type="BINDATA" /> <include name="IDR_AURA_SHADOW_RECT_TOP_RIGHT" file="aura/shadow_rect_top_right.png" type="BINDATA" /> |