| Index: ash/wm/app_list_controller.cc
|
| diff --git a/ash/wm/app_list_controller.cc b/ash/wm/app_list_controller.cc
|
| index b92f491012e711270ee519c4ac56a1ae13a4bd3b..550a9552f2ed350fac518d7943a08484dbca08e0 100644
|
| --- a/ash/wm/app_list_controller.cc
|
| +++ b/ash/wm/app_list_controller.cc
|
| @@ -40,6 +40,11 @@
|
| // The maximum shift in pixels when over-scroll happens.
|
| const int kMaxOverScrollShift = 48;
|
|
|
| +// The minimal anchor position offset to make sure that the bubble is still on
|
| +// the screen with 8 pixels spacing on the left / right. This constant is a
|
| +// result of minimal bubble arrow sizes and offsets.
|
| +const int kMinimalAnchorPositionOffset = 57;
|
| +
|
| ui::Layer* GetLayer(views::Widget* widget) {
|
| return widget->GetNativeView()->layer();
|
| }
|
| @@ -77,6 +82,37 @@
|
| }
|
|
|
| return offseted;
|
| +}
|
| +
|
| +// Using |button_bounds|, determine the anchor offset so that the bubble gets
|
| +// shown above the shelf (used for the alternate shelf theme).
|
| +gfx::Vector2d GetAnchorPositionOffsetToShelf(
|
| + const gfx::Rect& button_bounds, views::Widget* widget) {
|
| + DCHECK(Shell::HasInstance());
|
| + ShelfAlignment shelf_alignment = Shell::GetInstance()->GetShelfAlignment(
|
| + widget->GetNativeView()->GetRootWindow());
|
| + gfx::Point anchor(button_bounds.CenterPoint());
|
| + switch (shelf_alignment) {
|
| + case SHELF_ALIGNMENT_TOP:
|
| + case SHELF_ALIGNMENT_BOTTOM:
|
| + if (base::i18n::IsRTL()) {
|
| + int screen_width = widget->GetWorkAreaBoundsInScreen().width();
|
| + return gfx::Vector2d(
|
| + std::min(screen_width - kMinimalAnchorPositionOffset - anchor.x(),
|
| + 0), 0);
|
| + }
|
| + return gfx::Vector2d(
|
| + std::max(kMinimalAnchorPositionOffset - anchor.x(), 0), 0);
|
| + case SHELF_ALIGNMENT_LEFT:
|
| + return gfx::Vector2d(
|
| + 0, std::max(kMinimalAnchorPositionOffset - anchor.y(), 0));
|
| + case SHELF_ALIGNMENT_RIGHT:
|
| + return gfx::Vector2d(
|
| + 0, std::max(kMinimalAnchorPositionOffset - anchor.y(), 0));
|
| + default:
|
| + NOTREACHED();
|
| + return gfx::Vector2d();
|
| + }
|
| }
|
|
|
| } // namespace
|
| @@ -140,6 +176,23 @@
|
| Shell::GetScreen()->GetPrimaryDisplay().bounds().CenterPoint(),
|
| views::BubbleBorder::FLOAT,
|
| true /* border_accepts_events */);
|
| + } else if (ash::switches::UseAlternateShelfLayout()) {
|
| + gfx::Rect applist_button_bounds = Shelf::ForWindow(container)->
|
| + GetAppListButtonView()->GetBoundsInScreen();
|
| + // We need the location of the button within the local screen.
|
| + applist_button_bounds = ScreenUtil::ConvertRectFromScreen(
|
| + root_window,
|
| + applist_button_bounds);
|
| + view->InitAsBubbleAttachedToAnchor(
|
| + container,
|
| + pagination_model_.get(),
|
| + Shelf::ForWindow(container)->GetAppListButtonView(),
|
| + GetAnchorPositionOffsetToShelf(applist_button_bounds,
|
| + Shelf::ForWindow(container)->GetAppListButtonView()->
|
| + GetWidget()),
|
| + GetBubbleArrow(container),
|
| + true /* border_accepts_events */);
|
| + view->SetArrowPaintType(views::BubbleBorder::PAINT_NONE);
|
| } else {
|
| view->InitAsBubbleAttachedToAnchor(
|
| container,
|
|
|