| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/shelf/shelf_layout_manager.h" | 5 #include "ash/shelf/shelf_layout_manager.h" |
| 6 | 6 |
| 7 #include "ash/aura/wm_window_aura.h" | 7 #include "ash/aura/wm_window_aura.h" |
| 8 #include "ash/common/accelerators/accelerator_controller.h" | 8 #include "ash/common/accelerators/accelerator_controller.h" |
| 9 #include "ash/common/accelerators/accelerator_table.h" | 9 #include "ash/common/accelerators/accelerator_table.h" |
| 10 #include "ash/common/ash_switches.h" | 10 #include "ash/common/ash_switches.h" |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState()); | 517 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState()); |
| 518 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior()); | 518 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior()); |
| 519 EXPECT_EQ(GetShelfWidget()->GetDimmerBoundsForTest(), gfx::Rect()); | 519 EXPECT_EQ(GetShelfWidget()->GetDimmerBoundsForTest(), gfx::Rect()); |
| 520 EXPECT_EQ(bounds_noshelf.ToString(), window->bounds().ToString()); | 520 EXPECT_EQ(bounds_noshelf.ToString(), window->bounds().ToString()); |
| 521 EXPECT_EQ(shelf_hidden.ToString(), | 521 EXPECT_EQ(shelf_hidden.ToString(), |
| 522 GetShelfWidget()->GetWindowBoundsInScreen().ToString()); | 522 GetShelfWidget()->GetWindowBoundsInScreen().ToString()); |
| 523 | 523 |
| 524 // Put |widget| into fullscreen. Set the shelf to be auto hidden when |widget| | 524 // Put |widget| into fullscreen. Set the shelf to be auto hidden when |widget| |
| 525 // is fullscreen. (eg browser immersive fullscreen). | 525 // is fullscreen. (eg browser immersive fullscreen). |
| 526 widget->SetFullscreen(true); | 526 widget->SetFullscreen(true); |
| 527 wm::GetWindowState(window)->set_shelf_mode_in_fullscreen( | 527 wm::GetWindowState(window)->set_hide_shelf_when_fullscreen(false); |
| 528 ash::wm::WindowState::SHELF_AUTO_HIDE_VISIBLE); | |
| 529 layout_manager->UpdateVisibilityState(); | 528 layout_manager->UpdateVisibilityState(); |
| 530 | 529 |
| 531 gfx::Rect bounds_fullscreen = window->bounds(); | 530 gfx::Rect bounds_fullscreen = window->bounds(); |
| 532 EXPECT_TRUE(widget->IsFullscreen()); | 531 EXPECT_TRUE(widget->IsFullscreen()); |
| 533 | 532 |
| 534 // Shelf hints are removed in immersive full screen mode in MD; and some shelf | 533 // Shelf hints are removed in immersive full screen mode in MD; and some shelf |
| 535 // hints are shown in non-MD mode. | 534 // hints are shown in non-MD mode. |
| 536 if (ash::MaterialDesignController::IsShelfMaterial()) | 535 if (ash::MaterialDesignController::IsShelfMaterial()) |
| 537 EXPECT_EQ(bounds_noshelf.ToString(), bounds_fullscreen.ToString()); | 536 EXPECT_EQ(bounds_noshelf.ToString(), bounds_fullscreen.ToString()); |
| 538 else | 537 else |
| (...skipping 17 matching lines...) Expand all Loading... |
| 556 below_start, end, kTimeDelta, kNumScrollSteps, | 555 below_start, end, kTimeDelta, kNumScrollSteps, |
| 557 base::Bind(&ShelfDragCallback::ProcessScroll, | 556 base::Bind(&ShelfDragCallback::ProcessScroll, |
| 558 base::Unretained(&handler))); | 557 base::Unretained(&handler))); |
| 559 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); | 558 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); |
| 560 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState()); | 559 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState()); |
| 561 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior()); | 560 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior()); |
| 562 EXPECT_EQ(shelf_hidden.ToString(), | 561 EXPECT_EQ(shelf_hidden.ToString(), |
| 563 GetShelfWidget()->GetWindowBoundsInScreen().ToString()); | 562 GetShelfWidget()->GetWindowBoundsInScreen().ToString()); |
| 564 EXPECT_EQ(bounds_fullscreen.ToString(), window->bounds().ToString()); | 563 EXPECT_EQ(bounds_fullscreen.ToString(), window->bounds().ToString()); |
| 565 | 564 |
| 566 // Set the shelf to be auto hide and invisible when |widget| is fullscreen. | |
| 567 // (used in arc immersive fullscreen) | |
| 568 wm::GetWindowState(window)->set_shelf_mode_in_fullscreen( | |
| 569 ash::wm::WindowState::SHELF_AUTO_HIDE_INVISIBLE); | |
| 570 layout_manager->UpdateVisibilityState(); | |
| 571 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); | |
| 572 EXPECT_TRUE(widget->IsFullscreen()); | |
| 573 EXPECT_EQ(display::Screen::GetScreen()->GetPrimaryDisplay().bounds(), | |
| 574 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); | |
| 575 | |
| 576 // Switch from invisible to visible autodhide. | |
| 577 wm::GetWindowState(window)->set_shelf_mode_in_fullscreen( | |
| 578 ash::wm::WindowState::SHELF_AUTO_HIDE_VISIBLE); | |
| 579 layout_manager->UpdateVisibilityState(); | |
| 580 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); | |
| 581 EXPECT_TRUE(widget->IsFullscreen()); | |
| 582 EXPECT_NE(display::Screen::GetScreen()->GetPrimaryDisplay().bounds(), | |
| 583 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); | |
| 584 | |
| 585 // Switch from invisible to visible autodhide. | |
| 586 wm::GetWindowState(window)->set_shelf_mode_in_fullscreen( | |
| 587 ash::wm::WindowState::SHELF_AUTO_HIDE_INVISIBLE); | |
| 588 layout_manager->UpdateVisibilityState(); | |
| 589 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); | |
| 590 EXPECT_TRUE(widget->IsFullscreen()); | |
| 591 EXPECT_EQ(display::Screen::GetScreen()->GetPrimaryDisplay().bounds(), | |
| 592 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); | |
| 593 | |
| 594 // Set the shelf to be hidden when |widget| is fullscreen. (eg tab fullscreen | 565 // Set the shelf to be hidden when |widget| is fullscreen. (eg tab fullscreen |
| 595 // with or without immersive browser fullscreen). | 566 // with or without immersive browser fullscreen). |
| 596 wm::GetWindowState(window)->set_shelf_mode_in_fullscreen( | 567 wm::GetWindowState(window)->set_hide_shelf_when_fullscreen(true); |
| 597 ash::wm::WindowState::SHELF_HIDDEN); | |
| 598 | |
| 599 layout_manager->UpdateVisibilityState(); | 568 layout_manager->UpdateVisibilityState(); |
| 600 EXPECT_EQ(SHELF_HIDDEN, shelf->GetVisibilityState()); | 569 EXPECT_EQ(SHELF_HIDDEN, shelf->GetVisibilityState()); |
| 601 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior()); | 570 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior()); |
| 602 | 571 |
| 603 // Swipe-up. This should not change anything. | 572 // Swipe-up. This should not change anything. |
| 604 end = start - delta; | 573 end = start - delta; |
| 605 generator.GestureScrollSequenceWithCallback( | 574 generator.GestureScrollSequenceWithCallback( |
| 606 below_start, end, kTimeDelta, kNumScrollSteps, | 575 below_start, end, kTimeDelta, kNumScrollSteps, |
| 607 base::Bind(&ShelfDragCallback::ProcessScroll, | 576 base::Bind(&ShelfDragCallback::ProcessScroll, |
| 608 base::Unretained(&handler))); | 577 base::Unretained(&handler))); |
| (...skipping 1468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2077 | 2046 |
| 2078 // Open keyboard in sticky mode. | 2047 // Open keyboard in sticky mode. |
| 2079 kb_controller->ShowKeyboard(true); | 2048 kb_controller->ShowKeyboard(true); |
| 2080 layout_manager->OnKeyboardBoundsChanging(keyboard_bounds()); | 2049 layout_manager->OnKeyboardBoundsChanging(keyboard_bounds()); |
| 2081 | 2050 |
| 2082 // Work area should be changed. | 2051 // Work area should be changed. |
| 2083 EXPECT_NE(orig_work_area, | 2052 EXPECT_NE(orig_work_area, |
| 2084 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); | 2053 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); |
| 2085 } | 2054 } |
| 2086 | 2055 |
| 2087 } // namespace ash | 2056 } // namespace ash |
| OLD | NEW |