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

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: Use GetScreenCenter abstraction. 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..b3df2d38ed472a316559d8de24339eb48f77b166 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);
@@ -165,12 +171,13 @@ void AppListController::SetVisible(bool visible, aura::Window* window) {
aura::Window* root_window = window->GetRootWindow();
aura::Window* container = GetRootWindowController(root_window)->
GetContainer(kShellWindowId_AppListContainer);
- if (app_list::switches::IsExperimentalAppListPositionEnabled()) {
+ is_centered_ = app_list::switches::IsExperimentalAppListPositionEnabled();
+ if (is_centered_) {
// The experimental app list is centered over the primary display.
- view->InitAsBubbleCenteredOnPrimaryDisplay(
+ view->InitAsBubbleAtFixedLocation(
NULL,
pagination_model_.get(),
- Shell::GetScreen(),
+ GetScreenCenter(),
views::BubbleBorder::FLOAT,
true /* border_accepts_events */);
} else {
@@ -302,8 +309,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