Chromium Code Reviews| Index: ash/wm/app_list_controller.cc |
| diff --git a/ash/wm/app_list_controller.cc b/ash/wm/app_list_controller.cc |
| index bf631e79a21b97b53544dd23f26532b49237fb69..4f24ed46dce65b68b99a331fc15f442a050d0c9b 100644 |
| --- a/ash/wm/app_list_controller.cc |
| +++ b/ash/wm/app_list_controller.cc |
| @@ -113,6 +113,11 @@ gfx::Vector2d GetAnchorPositionOffsetToShelf( |
| } |
| } |
| +// Gets the point at the center of the screen. |
| +gfx::Point GetScreenCenter() { |
| + return Shell::GetScreen()->GetPrimaryDisplay().bounds().CenterPoint(); |
| +} |
| + |
| } // namespace |
| //////////////////////////////////////////////////////////////////////////////// |
| @@ -121,6 +126,7 @@ gfx::Vector2d GetAnchorPositionOffsetToShelf( |
| AppListController::AppListController() |
| : pagination_model_(new app_list::PaginationModel), |
| is_visible_(false), |
| + is_centered_(false), |
| view_(NULL), |
| should_snap_back_(false) { |
| Shell::GetInstance()->AddShellObserver(this); |
| @@ -167,13 +173,15 @@ void AppListController::SetVisible(bool visible, aura::Window* window) { |
| GetContainer(kShellWindowId_AppListContainer); |
| if (app_list::switches::IsExperimentalAppListPositionEnabled()) { |
|
varkha
2014/04/30 16:37:38
nit: maybe:
is_centered_ = app_list::switches::IsE
Matt Giuca
2014/05/01 03:54:32
Done. (Nice)
|
| // The experimental app list is centered over the primary display. |
| - view->InitAsBubbleCenteredOnPrimaryDisplay( |
| + is_centered_ = true; |
| + view->InitAsBubbleAtFixedLocation( |
| NULL, |
| pagination_model_.get(), |
| - Shell::GetScreen(), |
| + Shell::GetScreen()->GetPrimaryDisplay().bounds().CenterPoint(), |
|
varkha
2014/04/30 16:37:38
Could use GetScreenCenter().
Matt Giuca
2014/05/01 03:54:32
I can't find anything called GetScreenCenter or Sc
varkha
2014/05/01 03:57:21
It's a new method in this file's anonymous namespa
Matt Giuca
2014/05/01 04:02:43
/me hits self over head with hammer.
Sorry, I mus
varkha
2014/05/01 04:04:50
Great, you got it in time.
|
| views::BubbleBorder::FLOAT, |
| true /* border_accepts_events */); |
| } else { |
| + is_centered_ = false; |
| gfx::Rect applist_button_bounds = Shelf::ForWindow(container)-> |
| GetAppListButtonView()->GetBoundsInScreen(); |
| // We need the location of the button within the local screen. |
| @@ -302,8 +310,13 @@ void AppListController::ProcessLocatedEvent(ui::LocatedEvent* event) { |
| } |
| void AppListController::UpdateBounds() { |
| - if (view_ && is_visible_) |
| - view_->UpdateBounds(); |
| + if (!view_ || !is_visible_) |
| + return; |
| + |
| + view_->UpdateBounds(); |
| + |
| + if (is_centered_) |
| + view_->SetAnchorPoint(GetScreenCenter()); |
| } |
| //////////////////////////////////////////////////////////////////////////////// |