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

Unified Diff: ash/shelf/shelf_layout_manager.cc

Issue 1907363004: (Merge to M-51) Revise the shelf alignment locking mechanism. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 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/shelf/shelf_layout_manager.h ('k') | ash/shelf/shelf_layout_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/shelf/shelf_layout_manager.cc
diff --git a/ash/shelf/shelf_layout_manager.cc b/ash/shelf/shelf_layout_manager.cc
index f0330e74e6ee775043983863c5e3292ba887bc27..4dc73aba2f340ba3b8db003ed7eed629babcb6f3 100644
--- a/ash/shelf/shelf_layout_manager.cc
+++ b/ash/shelf/shelf_layout_manager.cc
@@ -19,6 +19,7 @@
#include "ash/shelf/shelf_bezel_event_filter.h"
#include "ash/shelf/shelf_constants.h"
#include "ash/shelf/shelf_layout_manager_observer.h"
+#include "ash/shelf/shelf_util.h"
#include "ash/shelf/shelf_widget.h"
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
@@ -386,6 +387,7 @@ void ShelfLayoutManager::CompleteGestureDrag(const ui::GestureEvent& gesture) {
bool correct_direction = false;
switch (GetAlignment()) {
case SHELF_ALIGNMENT_BOTTOM:
+ case SHELF_ALIGNMENT_BOTTOM_LOCKED:
case SHELF_ALIGNMENT_RIGHT:
correct_direction = gesture_drag_amount_ < 0;
break;
@@ -490,26 +492,7 @@ void ShelfLayoutManager::OnWindowActivated(
}
bool ShelfLayoutManager::IsHorizontalAlignment() const {
- return GetAlignment() == SHELF_ALIGNMENT_BOTTOM;
-}
-
-bool ShelfLayoutManager::IsAlignmentLocked() const {
- if (state_.is_screen_locked)
- return true;
- // The session state becomes active at the start of transitioning to a user
- // session, however the session is considered blocked until the full UI is
- // ready. Exit early to allow for proper layout.
- SessionStateDelegate* session_state_delegate =
- Shell::GetInstance()->session_state_delegate();
- if (session_state_delegate->GetSessionState() ==
- SessionStateDelegate::SESSION_STATE_ACTIVE) {
- return false;
- }
- if (session_state_delegate->IsUserSessionBlocked() ||
- state_.is_adding_user_screen) {
- return true;
- }
- return false;
+ return ash::IsHorizontalAlignment(GetAlignment());
}
void ShelfLayoutManager::SetChromeVoxPanelHeight(int height) {
@@ -851,7 +834,7 @@ void ShelfLayoutManager::UpdateTargetBoundsForGesture(
int shelf_height = target_bounds->shelf_bounds_in_root.height() - translate;
shelf_height = std::max(shelf_height, kAutoHideSize);
target_bounds->shelf_bounds_in_root.set_height(shelf_height);
- if (GetAlignment() == SHELF_ALIGNMENT_BOTTOM) {
+ if (IsHorizontalAlignment()) {
target_bounds->shelf_bounds_in_root.set_y(
available_bounds.bottom() - shelf_height);
}
@@ -1007,7 +990,7 @@ ShelfAutoHideState ShelfLayoutManager::CalculateAutoHideState(
ShelfAlignment alignment = GetAlignment();
shelf_region.Inset(
alignment == SHELF_ALIGNMENT_RIGHT ? -kNotificationBubbleGapHeight : 0,
- alignment == SHELF_ALIGNMENT_BOTTOM ? -kNotificationBubbleGapHeight : 0,
+ IsHorizontalAlignment() ? -kNotificationBubbleGapHeight : 0,
alignment == SHELF_ALIGNMENT_LEFT ? -kNotificationBubbleGapHeight : 0,
0);
}
@@ -1117,9 +1100,6 @@ void ShelfLayoutManager::SessionStateChanged(
void ShelfLayoutManager::UpdateShelfVisibilityAfterLoginUIChange() {
UpdateVisibilityState();
LayoutShelf();
- // The shelf alignment may have changed when it was unlocked.
- Shell::GetInstance()->OnShelfAlignmentChanged(
- shelf_->GetNativeWindow()->GetRootWindow());
}
} // namespace ash
« no previous file with comments | « ash/shelf/shelf_layout_manager.h ('k') | ash/shelf/shelf_layout_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698