Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2321)

Unified Diff: ash/wm/app_list_controller.cc

Issue 260663002: AppListController now responsible for ensuring app list stays centered. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/wm/app_list_controller.h ('k') | ui/app_list/views/app_list_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
}
////////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « ash/wm/app_list_controller.h ('k') | ui/app_list/views/app_list_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698