summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorskuhne <skuhne@chromium.org>2014-11-27 10:36:34 -0800
committerCommit bot <commit-bot@chromium.org>2014-11-27 18:37:54 +0000
commit704263df6d8241491f4f1ed93dd1a19f65aaade6 (patch)
tree3f7d3e7288b703b601c7167bb592b90e62bf7baa
parent2bafab419155e4a573c61befe6a5fd4c08a31dbd (diff)
downloadchromium_src-704263df6d8241491f4f1ed93dd1a19f65aaade6.zip
chromium_src-704263df6d8241491f4f1ed93dd1a19f65aaade6.tar.gz
chromium_src-704263df6d8241491f4f1ed93dd1a19f65aaade6.tar.bz2
Fixing "shelf confusion" with alignment
This is fixing the mentioned issue - however there are other issues which still need to be addressed (bigger refactor). BUG=342232 TEST=visual Review URL: https://codereview.chromium.org/740343005 Cr-Commit-Position: refs/heads/master@{#306016}
-rw-r--r--ash/shelf/shelf_layout_manager.cc10
-rw-r--r--ash/shelf/shelf_layout_manager.h10
-rw-r--r--ash/shelf/shelf_widget.cc6
-rw-r--r--chrome/browser/ui/ash/launcher/launcher_context_menu.cc6
4 files changed, 23 insertions, 9 deletions
diff --git a/ash/shelf/shelf_layout_manager.cc b/ash/shelf/shelf_layout_manager.cc
index 178634c..340ab77 100644
--- a/ash/shelf/shelf_layout_manager.cc
+++ b/ash/shelf/shelf_layout_manager.cc
@@ -251,9 +251,15 @@ bool ShelfLayoutManager::SetAlignment(ShelfAlignment alignment) {
if (alignment_ == alignment)
return false;
- // This should not be called during the lock screen transitions.
- DCHECK(!Shell::GetInstance()->session_state_delegate()->IsScreenLocked());
alignment_ = alignment;
+ if (Shell::GetInstance()->session_state_delegate()->IsScreenLocked()) {
+ // The shelf will itself move to the bottom while locked. If a request is
+ // sent to move while being locked, we postpone the move untill the lock
+ // screen goes away.
+ return false;
+ }
+
+ // This should not be called during the lock screen transitions.
shelf_->SetAlignment(alignment);
LayoutShelf();
return true;
diff --git a/ash/shelf/shelf_layout_manager.h b/ash/shelf/shelf_layout_manager.h
index ac0c69d..bb3f34d 100644
--- a/ash/shelf/shelf_layout_manager.h
+++ b/ash/shelf/shelf_layout_manager.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -90,9 +90,13 @@ class ASH_EXPORT ShelfLayoutManager
return auto_hide_behavior_;
}
- // Sets the alignment. Returns true if the alignment is changed. Otherwise,
- // returns false.
+ // Sets the alignment. Returns true if the alignment got changed. If nothing
+ // has visually be changed, false will be returned. This can happen if either
+ // the alignment was already set, or the shelf is currently locked and cannot
+ // be changed at this time. In the latter case the change will be performed
+ // once the shelf gets unlocked.
bool SetAlignment(ShelfAlignment alignment);
+
// Returns the desired alignment for the current state, either the user's
// set alignment (alignment_) or SHELF_ALIGNMENT_BOTTOM when the screen
// is locked.
diff --git a/ash/shelf/shelf_widget.cc b/ash/shelf/shelf_widget.cc
index 73bbeaa..ad9d6b6 100644
--- a/ash/shelf/shelf_widget.cc
+++ b/ash/shelf/shelf_widget.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -710,10 +710,12 @@ bool ShelfWidget::ShelfAlignmentAllowed() {
Shell::GetInstance()->system_tray_delegate()->GetUserLoginStatus();
switch (login_status) {
+ case user::LOGGED_IN_LOCKED:
+ // Shelf alignment changes can be requested while being locked, but will
+ // be applied upon unlock.
case user::LOGGED_IN_USER:
case user::LOGGED_IN_OWNER:
return true;
- case user::LOGGED_IN_LOCKED:
case user::LOGGED_IN_PUBLIC:
case user::LOGGED_IN_SUPERVISED:
case user::LOGGED_IN_GUEST:
diff --git a/chrome/browser/ui/ash/launcher/launcher_context_menu.cc b/chrome/browser/ui/ash/launcher/launcher_context_menu.cc
index 2971b5d..22a4419 100644
--- a/chrome/browser/ui/ash/launcher/launcher_context_menu.cc
+++ b/chrome/browser/ui/ash/launcher/launcher_context_menu.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -9,6 +9,7 @@
#include "ash/desktop_background/user_wallpaper_delegate.h"
#include "ash/metrics/user_metrics_recorder.h"
#include "ash/root_window_controller.h"
+#include "ash/session/session_state_delegate.h"
#include "ash/shelf/shelf_item_delegate.h"
#include "ash/shelf/shelf_widget.h"
#include "ash/shell.h"
@@ -176,7 +177,8 @@ void LauncherContextMenu::Init() {
AddCheckItemWithStringId(MENU_AUTO_HIDE,
IDS_ASH_SHELF_CONTEXT_MENU_AUTO_HIDE);
}
- if (ash::ShelfWidget::ShelfAlignmentAllowed()) {
+ if (ash::ShelfWidget::ShelfAlignmentAllowed() &&
+ !ash::Shell::GetInstance()->session_state_delegate()->IsScreenLocked()) {
AddSubMenuWithStringId(MENU_ALIGNMENT_MENU,
IDS_ASH_SHELF_CONTEXT_MENU_POSITION,
&shelf_alignment_menu_);