Autohide behavior simplified to always/never
BUG=146773 Review URL: https://chromiumcodereview.appspot.com/10987005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@158639 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
@ -25,38 +25,19 @@ LauncherContextMenu::~LauncherContextMenu() {
|
||||
|
||||
// static
|
||||
bool LauncherContextMenu::IsAutoHideMenuHideChecked() {
|
||||
internal::RootWindowController* controller =
|
||||
Shell::GetPrimaryRootWindowController();
|
||||
ash::ShelfAutoHideBehavior auto_hide_behavior =
|
||||
return ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS ==
|
||||
Shell::GetInstance()->GetShelfAutoHideBehavior();
|
||||
return (controller->IsInMaximizedMode() &&
|
||||
(auto_hide_behavior == ash::SHELF_AUTO_HIDE_BEHAVIOR_DEFAULT ||
|
||||
auto_hide_behavior == ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS)) ||
|
||||
(!controller->IsInMaximizedMode() &&
|
||||
auto_hide_behavior == ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
|
||||
}
|
||||
|
||||
// static
|
||||
ShelfAutoHideBehavior LauncherContextMenu::GetToggledAutoHideBehavior() {
|
||||
ash::ShelfAutoHideBehavior auto_hide_behavior;
|
||||
if (Shell::GetPrimaryRootWindowController()->IsInMaximizedMode()) {
|
||||
if (IsAutoHideMenuHideChecked())
|
||||
auto_hide_behavior = ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER;
|
||||
else
|
||||
auto_hide_behavior = ash::SHELF_AUTO_HIDE_BEHAVIOR_DEFAULT;
|
||||
} else if (IsAutoHideMenuHideChecked()) {
|
||||
auto_hide_behavior = ash::SHELF_AUTO_HIDE_BEHAVIOR_DEFAULT;
|
||||
} else {
|
||||
auto_hide_behavior = ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS;
|
||||
}
|
||||
return auto_hide_behavior;
|
||||
return IsAutoHideMenuHideChecked() ? ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER :
|
||||
ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS;
|
||||
}
|
||||
|
||||
// static
|
||||
int LauncherContextMenu::GetAutoHideResourceStringId() {
|
||||
return Shell::GetPrimaryRootWindowController()->IsInMaximizedMode() ?
|
||||
IDS_AURA_LAUNCHER_CONTEXT_MENU_AUTO_HIDE_MAXIMIZED :
|
||||
IDS_AURA_LAUNCHER_CONTEXT_MENU_AUTO_HIDE_NOT_MAXIMIZED;
|
||||
return IDS_AURA_LAUNCHER_CONTEXT_MENU_AUTO_HIDE_NOT_MAXIMIZED;
|
||||
}
|
||||
|
||||
bool LauncherContextMenu::IsCommandIdChecked(int command_id) const {
|
||||
|
@ -29,29 +29,25 @@ TEST_F(LauncherContextMenuTest, ToggleAutoHide) {
|
||||
wm::ActivateWindow(window.get());
|
||||
|
||||
Shell* shell = Shell::GetInstance();
|
||||
// If the auto-hide behavior isn't DEFAULT, the rest of the tests don't make
|
||||
// sense.
|
||||
EXPECT_EQ(ash::SHELF_AUTO_HIDE_BEHAVIOR_DEFAULT,
|
||||
shell->GetShelfAutoHideBehavior());
|
||||
EXPECT_FALSE(LauncherContextMenu::IsAutoHideMenuHideChecked());
|
||||
shell->SetShelfAutoHideBehavior(
|
||||
LauncherContextMenu::GetToggledAutoHideBehavior());
|
||||
shell->SetShelfAutoHideBehavior(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
|
||||
EXPECT_EQ(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS,
|
||||
shell->GetShelfAutoHideBehavior());
|
||||
shell->SetShelfAutoHideBehavior(
|
||||
LauncherContextMenu::GetToggledAutoHideBehavior());
|
||||
EXPECT_EQ(ash::SHELF_AUTO_HIDE_BEHAVIOR_DEFAULT,
|
||||
shell->GetShelfAutoHideBehavior());
|
||||
|
||||
window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
|
||||
EXPECT_TRUE(LauncherContextMenu::IsAutoHideMenuHideChecked());
|
||||
shell->SetShelfAutoHideBehavior(
|
||||
LauncherContextMenu::GetToggledAutoHideBehavior());
|
||||
EXPECT_EQ(ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER,
|
||||
shell->GetShelfAutoHideBehavior());
|
||||
|
||||
window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
|
||||
EXPECT_FALSE(LauncherContextMenu::IsAutoHideMenuHideChecked());
|
||||
shell->SetShelfAutoHideBehavior(
|
||||
LauncherContextMenu::GetToggledAutoHideBehavior());
|
||||
EXPECT_EQ(ash::SHELF_AUTO_HIDE_BEHAVIOR_DEFAULT,
|
||||
EXPECT_EQ(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS,
|
||||
shell->GetShelfAutoHideBehavior());
|
||||
EXPECT_TRUE(LauncherContextMenu::IsAutoHideMenuHideChecked());
|
||||
shell->SetShelfAutoHideBehavior(
|
||||
LauncherContextMenu::GetToggledAutoHideBehavior());
|
||||
EXPECT_EQ(ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER,
|
||||
shell->GetShelfAutoHideBehavior());
|
||||
}
|
||||
|
||||
|
@ -92,6 +92,8 @@ typedef test::AshTestBase RootWindowControllerTest;
|
||||
TEST_F(RootWindowControllerTest, MoveWindows_Basic) {
|
||||
UpdateDisplay("600x600,500x500");
|
||||
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
|
||||
ash::Shell::GetInstance()->SetShelfAutoHideBehavior(
|
||||
ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
|
||||
|
||||
views::Widget* normal = CreateTestWidget(gfx::Rect(650, 10, 100, 100));
|
||||
EXPECT_EQ(root_windows[1], normal->GetNativeView()->GetRootWindow());
|
||||
@ -147,7 +149,7 @@ TEST_F(RootWindowControllerTest, MoveWindows_Basic) {
|
||||
EXPECT_EQ("50,10 100x100",
|
||||
normal->GetNativeView()->GetBoundsInRootWindow().ToString());
|
||||
|
||||
// Maximized area on primary display has 2px (given as
|
||||
// Maximized area on primary display has 3px (given as
|
||||
// kAutoHideSize in shelf_layout_manager.cc) inset at the bottom.
|
||||
EXPECT_EQ(root_windows[0], maximized->GetNativeView()->GetRootWindow());
|
||||
EXPECT_EQ("0,0 600x597",
|
||||
|
@ -22,6 +22,8 @@ typedef test::AshTestBase ScreenAshTest;
|
||||
#if !defined(OS_WIN)
|
||||
TEST_F(ScreenAshTest, Bounds) {
|
||||
UpdateDisplay("600x600,500x500");
|
||||
Shell::GetInstance()->SetShelfAutoHideBehavior(
|
||||
ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
|
||||
|
||||
views::Widget* primary =
|
||||
views::Widget::CreateWindowWithBounds(NULL, gfx::Rect(10, 10, 100, 100));
|
||||
@ -39,7 +41,7 @@ TEST_F(ScreenAshTest, Bounds) {
|
||||
secondary->GetNativeView()).ToString());
|
||||
|
||||
// Unmaximized work area bounds
|
||||
EXPECT_EQ("0,0 600x552",
|
||||
EXPECT_EQ("0,0 600x597",
|
||||
ScreenAsh::GetUnmaximizedWorkAreaBoundsInParent(
|
||||
primary->GetNativeView()).ToString());
|
||||
EXPECT_EQ("0,0 500x500",
|
||||
@ -55,7 +57,7 @@ TEST_F(ScreenAshTest, Bounds) {
|
||||
secondary->GetNativeView()).ToString());
|
||||
|
||||
// Work area bounds
|
||||
EXPECT_EQ("0,0 600x552",
|
||||
EXPECT_EQ("0,0 600x597",
|
||||
ScreenAsh::GetDisplayWorkAreaBoundsInParent(
|
||||
primary->GetNativeView()).ToString());
|
||||
EXPECT_EQ("0,0 500x500",
|
||||
|
@ -175,7 +175,7 @@ class ShelfLayoutManager::UpdateShelfObserver
|
||||
ShelfLayoutManager::ShelfLayoutManager(views::Widget* status)
|
||||
: root_window_(Shell::GetPrimaryRootWindow()),
|
||||
in_layout_(false),
|
||||
auto_hide_behavior_(SHELF_AUTO_HIDE_BEHAVIOR_DEFAULT),
|
||||
auto_hide_behavior_(SHELF_AUTO_HIDE_BEHAVIOR_NEVER),
|
||||
alignment_(SHELF_ALIGNMENT_BOTTOM),
|
||||
launcher_(NULL),
|
||||
status_(status),
|
||||
@ -297,8 +297,8 @@ void ShelfLayoutManager::UpdateVisibilityState() {
|
||||
break;
|
||||
|
||||
case WORKSPACE_WINDOW_STATE_MAXIMIZED:
|
||||
SetState(auto_hide_behavior_ != SHELF_AUTO_HIDE_BEHAVIOR_NEVER ?
|
||||
AUTO_HIDE : VISIBLE);
|
||||
SetState(auto_hide_behavior_ == SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS ?
|
||||
AUTO_HIDE : VISIBLE);
|
||||
break;
|
||||
|
||||
case WORKSPACE_WINDOW_STATE_WINDOW_OVERLAPS_SHELF:
|
||||
@ -498,8 +498,7 @@ ShelfLayoutManager::TargetBounds::TargetBounds() : opacity(0.0f) {}
|
||||
gfx::Rect ShelfLayoutManager::GetMaximizedWindowBounds(
|
||||
aura::Window* window) {
|
||||
gfx::Rect bounds(ScreenAsh::GetDisplayBoundsInParent(window));
|
||||
if (auto_hide_behavior_ == SHELF_AUTO_HIDE_BEHAVIOR_DEFAULT ||
|
||||
auto_hide_behavior_ == SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS) {
|
||||
if (auto_hide_behavior_ == SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS) {
|
||||
AdjustBoundsBasedOnAlignment(kAutoHideSize, &bounds);
|
||||
return bounds;
|
||||
}
|
||||
|
@ -311,6 +311,7 @@ TEST_F(ShelfLayoutManagerTest, AutoHide) {
|
||||
generator.MoveMouseTo(0, 0);
|
||||
|
||||
ShelfLayoutManager* shelf = GetShelfLayoutManager();
|
||||
shelf->SetAutoHideBehavior(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
|
||||
views::Widget* widget = new views::Widget;
|
||||
views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
|
||||
params.bounds = gfx::Rect(0, 0, 200, 200);
|
||||
@ -374,6 +375,7 @@ TEST_F(ShelfLayoutManagerTest, VisibleWhenLockScreenShowing) {
|
||||
generator.MoveMouseTo(0, 0);
|
||||
|
||||
ShelfLayoutManager* shelf = GetShelfLayoutManager();
|
||||
shelf->SetAutoHideBehavior(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
|
||||
views::Widget* widget = new views::Widget;
|
||||
views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
|
||||
params.bounds = gfx::Rect(0, 0, 200, 200);
|
||||
@ -434,20 +436,12 @@ TEST_F(ShelfLayoutManagerTest, SetAutoHideBehavior) {
|
||||
aura::Window* window = widget->GetNativeWindow();
|
||||
gfx::Rect display_bounds(
|
||||
gfx::Screen::GetDisplayNearestWindow(window).bounds());
|
||||
EXPECT_EQ(display_bounds.bottom() - ShelfLayoutManager::kAutoHideSize,
|
||||
shelf->GetMaximizedWindowBounds(window).bottom());
|
||||
EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state());
|
||||
|
||||
shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
|
||||
EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state());
|
||||
EXPECT_EQ(display_bounds.bottom() - ShelfLayoutManager::kAutoHideSize,
|
||||
shelf->GetMaximizedWindowBounds(window).bottom());
|
||||
|
||||
shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_DEFAULT);
|
||||
EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state());
|
||||
EXPECT_EQ(display_bounds.bottom() - ShelfLayoutManager::kAutoHideSize,
|
||||
shelf->GetMaximizedWindowBounds(window).bottom());
|
||||
|
||||
shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
|
||||
EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state());
|
||||
EXPECT_GT(display_bounds.bottom() - ShelfLayoutManager::kAutoHideSize,
|
||||
@ -511,7 +505,7 @@ TEST_F(ShelfLayoutManagerTest, OpenAppListWithShelfVisibleState) {
|
||||
Shell* shell = Shell::GetInstance();
|
||||
ShelfLayoutManager* shelf = Shell::GetInstance()->shelf();
|
||||
shelf->LayoutShelf();
|
||||
shell->SetShelfAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_DEFAULT);
|
||||
shell->SetShelfAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
|
||||
|
||||
// Create a normal unmaximized windowm shelf should be visible.
|
||||
aura::Window* window = CreateTestWindow();
|
||||
@ -538,7 +532,7 @@ TEST_F(ShelfLayoutManagerTest, OpenAppListWithShelfAutoHideState) {
|
||||
Shell* shell = Shell::GetInstance();
|
||||
ShelfLayoutManager* shelf = Shell::GetInstance()->shelf();
|
||||
shelf->LayoutShelf();
|
||||
shell->SetShelfAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_DEFAULT);
|
||||
shell->SetShelfAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
|
||||
|
||||
// Create a window and show it in maximized state.
|
||||
aura::Window* window = CreateTestWindow();
|
||||
|
@ -14,9 +14,6 @@ enum ShelfAlignment {
|
||||
};
|
||||
|
||||
enum ShelfAutoHideBehavior {
|
||||
// The default; maximized windows trigger an auto-hide.
|
||||
SHELF_AUTO_HIDE_BEHAVIOR_DEFAULT,
|
||||
|
||||
// Always auto-hide.
|
||||
SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS,
|
||||
|
||||
|
@ -461,6 +461,7 @@ TEST_F(WorkspaceManager2Test, ShelfStateUpdated) {
|
||||
scoped_ptr<Window> w1(CreateTestWindow());
|
||||
const gfx::Rect w1_bounds(0, 1, 101, 102);
|
||||
ShelfLayoutManager* shelf = Shell::GetInstance()->shelf();
|
||||
shelf->SetAutoHideBehavior(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
|
||||
const gfx::Rect touches_shelf_bounds(
|
||||
0, shelf->GetIdealBounds().y() - 10, 101, 102);
|
||||
// Move |w1| to overlap the shelf.
|
||||
@ -483,7 +484,7 @@ TEST_F(WorkspaceManager2Test, ShelfStateUpdated) {
|
||||
w1->Show();
|
||||
wm::ActivateWindow(w1.get());
|
||||
|
||||
EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state());
|
||||
EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state());
|
||||
|
||||
// Maximize the window.
|
||||
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
|
||||
@ -492,7 +493,7 @@ TEST_F(WorkspaceManager2Test, ShelfStateUpdated) {
|
||||
|
||||
// Restore.
|
||||
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
|
||||
EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state());
|
||||
EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state());
|
||||
EXPECT_EQ("0,1 101x102", w1->bounds().ToString());
|
||||
|
||||
// Fullscreen.
|
||||
@ -501,7 +502,7 @@ TEST_F(WorkspaceManager2Test, ShelfStateUpdated) {
|
||||
|
||||
// Normal.
|
||||
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
|
||||
EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state());
|
||||
EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state());
|
||||
EXPECT_EQ("0,1 101x102", w1->bounds().ToString());
|
||||
EXPECT_FALSE(GetWindowOverlapsShelf());
|
||||
|
||||
@ -520,7 +521,7 @@ TEST_F(WorkspaceManager2Test, ShelfStateUpdated) {
|
||||
|
||||
// Minimize.
|
||||
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED);
|
||||
EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state());
|
||||
EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state());
|
||||
|
||||
// Since the restore from minimize will restore to the pre-minimize
|
||||
// state (tested elsewhere), we abandon the current size and restore
|
||||
@ -533,7 +534,7 @@ TEST_F(WorkspaceManager2Test, ShelfStateUpdated) {
|
||||
|
||||
// Restore.
|
||||
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
|
||||
EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state());
|
||||
EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state());
|
||||
EXPECT_EQ("0,1 101x102", w1->bounds().ToString());
|
||||
|
||||
// Create another window, maximized.
|
||||
@ -550,7 +551,7 @@ TEST_F(WorkspaceManager2Test, ShelfStateUpdated) {
|
||||
// Switch to w1.
|
||||
wm::ActivateWindow(w1.get());
|
||||
EXPECT_EQ(0, active_index());
|
||||
EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state());
|
||||
EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state());
|
||||
EXPECT_EQ("0,1 101x102", w1->bounds().ToString());
|
||||
EXPECT_EQ(ScreenAsh::GetMaximizedWindowBoundsInParent(
|
||||
w2->parent()).ToString(),
|
||||
|
@ -471,6 +471,7 @@ TEST_F(WorkspaceManagerTest, ShelfStateUpdated) {
|
||||
scoped_ptr<Window> w1(CreateTestWindow());
|
||||
const gfx::Rect w1_bounds(0, 1, 101, 102);
|
||||
ShelfLayoutManager* shelf = Shell::GetInstance()->shelf();
|
||||
shelf->SetAutoHideBehavior(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
|
||||
const gfx::Rect touches_shelf_bounds(
|
||||
0, shelf->GetIdealBounds().y() - 10, 101, 102);
|
||||
// Move |w1| to overlap the shelf.
|
||||
@ -493,7 +494,7 @@ TEST_F(WorkspaceManagerTest, ShelfStateUpdated) {
|
||||
w1->Show();
|
||||
wm::ActivateWindow(w1.get());
|
||||
|
||||
EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state());
|
||||
EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state());
|
||||
|
||||
// Maximize the window.
|
||||
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
|
||||
@ -502,7 +503,7 @@ TEST_F(WorkspaceManagerTest, ShelfStateUpdated) {
|
||||
|
||||
// Restore.
|
||||
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
|
||||
EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state());
|
||||
EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state());
|
||||
EXPECT_EQ("0,1 101x102", w1->bounds().ToString());
|
||||
|
||||
// Fullscreen.
|
||||
@ -511,7 +512,7 @@ TEST_F(WorkspaceManagerTest, ShelfStateUpdated) {
|
||||
|
||||
// Normal.
|
||||
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
|
||||
EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state());
|
||||
EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state());
|
||||
EXPECT_EQ("0,1 101x102", w1->bounds().ToString());
|
||||
|
||||
// Maximize again.
|
||||
@ -521,11 +522,11 @@ TEST_F(WorkspaceManagerTest, ShelfStateUpdated) {
|
||||
|
||||
// Minimize.
|
||||
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED);
|
||||
EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state());
|
||||
EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state());
|
||||
|
||||
// Restore.
|
||||
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
|
||||
EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state());
|
||||
EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state());
|
||||
EXPECT_EQ("0,1 101x102", w1->bounds().ToString());
|
||||
|
||||
// Create another window, maximized.
|
||||
@ -539,7 +540,7 @@ TEST_F(WorkspaceManagerTest, ShelfStateUpdated) {
|
||||
|
||||
// Switch to w1.
|
||||
w1->Show();
|
||||
EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state());
|
||||
EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state());
|
||||
EXPECT_EQ("0,1 101x102", w1->bounds().ToString());
|
||||
EXPECT_EQ(ScreenAsh::GetMaximizedWindowBoundsInParent(w2.get()).ToString(),
|
||||
w2->bounds().ToString());
|
||||
|
@ -35,7 +35,6 @@ namespace ash {
|
||||
const char kPinnedAppsPrefAppIDPath[] = "id";
|
||||
|
||||
const char kShelfAutoHideBehaviorAlways[] = "Always";
|
||||
const char kShelfAutoHideBehaviorDefault[] = "Default";
|
||||
const char kShelfAutoHideBehaviorNever[] = "Never";
|
||||
|
||||
extern const char kShelfAlignmentBottom[] = "Bottom";
|
||||
@ -52,7 +51,7 @@ void RegisterChromeLauncherUserPrefs(PrefService* user_prefs) {
|
||||
CreateDefaultPinnedAppsList(),
|
||||
PrefService::SYNCABLE_PREF);
|
||||
user_prefs->RegisterStringPref(prefs::kShelfAutoHideBehavior,
|
||||
kShelfAutoHideBehaviorDefault,
|
||||
kShelfAutoHideBehaviorNever,
|
||||
PrefService::SYNCABLE_PREF);
|
||||
user_prefs->RegisterStringPref(prefs::kShelfAlignment,
|
||||
kShelfAlignmentBottom,
|
||||
|
@ -21,7 +21,6 @@ extern const char kPinnedAppsPrefAppIDPath[];
|
||||
|
||||
// Values used for prefs::kShelfAutoHideBehavior.
|
||||
extern const char kShelfAutoHideBehaviorAlways[];
|
||||
extern const char kShelfAutoHideBehaviorDefault[];
|
||||
extern const char kShelfAutoHideBehaviorNever[];
|
||||
|
||||
// Values used for prefs::kShelfAlignment.
|
||||
|
@ -482,9 +482,6 @@ void ChromeLauncherController::SetAutoHideBehavior(
|
||||
ash::Shell::GetInstance()->SetShelfAutoHideBehavior(behavior);
|
||||
const char* value = NULL;
|
||||
switch (behavior) {
|
||||
case ash::SHELF_AUTO_HIDE_BEHAVIOR_DEFAULT:
|
||||
value = ash::kShelfAutoHideBehaviorDefault;
|
||||
break;
|
||||
case ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS:
|
||||
value = ash::kShelfAutoHideBehaviorAlways;
|
||||
break;
|
||||
@ -852,13 +849,16 @@ void ChromeLauncherController::UpdateAppLaunchersFromPref() {
|
||||
}
|
||||
|
||||
void ChromeLauncherController::SetShelfAutoHideBehaviorFromPrefs() {
|
||||
// Note: To maintain sync compatibility with old images of chrome/chromeos
|
||||
// the set of values that may be encountered includes the now-extinct
|
||||
// "Default" as well as "Never" and "Always", "Default" should now
|
||||
// be treated as "Never".
|
||||
// (http://code.google.com/p/chromium/issues/detail?id=146773)
|
||||
const std::string behavior_value(
|
||||
profile_->GetPrefs()->GetString(prefs::kShelfAutoHideBehavior));
|
||||
ash::ShelfAutoHideBehavior behavior =
|
||||
ash::SHELF_AUTO_HIDE_BEHAVIOR_DEFAULT;
|
||||
if (behavior_value == ash::kShelfAutoHideBehaviorNever)
|
||||
behavior = ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER;
|
||||
else if (behavior_value == ash::kShelfAutoHideBehaviorAlways)
|
||||
ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER;
|
||||
if (behavior_value == ash::kShelfAutoHideBehaviorAlways)
|
||||
behavior = ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS;
|
||||
ash::Shell::GetInstance()->SetShelfAutoHideBehavior(behavior);
|
||||
}
|
||||
|
Reference in New Issue
Block a user