Skip to content

Commit

Permalink
Rename MaximizeMode to TabletMode
Browse files Browse the repository at this point in the history
renamed
* maximize_mode_xxx files to tablet_mode_xxx
* Class name MaximizeModeXxx to TabletModeXxx
* variable names maximize_mode(xxx) to tablet_mode(xxx)
* comments "maximize mode" to "tablet mode"

BUG=726476
R=skuhne@chromium.org, sky@chromium.org, reveman@chromium.org
TEST=None

Review-Url: https://codereview.chromium.org/2906803002
Cr-Commit-Position: refs/heads/master@{#474940}
  • Loading branch information
mitoshima authored and Commit bot committed May 26, 2017
1 parent 6a5f851 commit 0827cd5
Show file tree
Hide file tree
Showing 99 changed files with 1,142 additions and 1,211 deletions.
48 changes: 24 additions & 24 deletions ash/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -667,23 +667,6 @@ component("ash") {
"wm/lock_state_observer.h",
"wm/lock_window_state.cc",
"wm/lock_window_state.h",
"wm/maximize_mode/maximize_mode_backdrop_delegate_impl.cc",
"wm/maximize_mode/maximize_mode_backdrop_delegate_impl.h",
"wm/maximize_mode/maximize_mode_controller.cc",
"wm/maximize_mode/maximize_mode_controller.h",
"wm/maximize_mode/maximize_mode_event_handler.cc",
"wm/maximize_mode/maximize_mode_event_handler.h",
"wm/maximize_mode/maximize_mode_event_handler_aura.cc",
"wm/maximize_mode/maximize_mode_event_handler_aura.h",
"wm/maximize_mode/maximize_mode_window_manager.cc",
"wm/maximize_mode/maximize_mode_window_manager.h",
"wm/maximize_mode/maximize_mode_window_state.cc",
"wm/maximize_mode/maximize_mode_window_state.h",
"wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard.h",
"wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_ozone.cc",
"wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_ozone.h",
"wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_x11.cc",
"wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_x11.h",
"wm/mru_window_tracker.cc",
"wm/mru_window_tracker.h",
"wm/overlay_event_filter.cc",
Expand Down Expand Up @@ -747,6 +730,23 @@ component("ash") {
"wm/system_modal_container_layout_manager.h",
"wm/system_wallpaper_controller.cc",
"wm/system_wallpaper_controller.h",
"wm/tablet_mode/scoped_disable_internal_mouse_and_keyboard.h",
"wm/tablet_mode/scoped_disable_internal_mouse_and_keyboard_ozone.cc",
"wm/tablet_mode/scoped_disable_internal_mouse_and_keyboard_ozone.h",
"wm/tablet_mode/scoped_disable_internal_mouse_and_keyboard_x11.cc",
"wm/tablet_mode/scoped_disable_internal_mouse_and_keyboard_x11.h",
"wm/tablet_mode/tablet_mode_backdrop_delegate_impl.cc",
"wm/tablet_mode/tablet_mode_backdrop_delegate_impl.h",
"wm/tablet_mode/tablet_mode_controller.cc",
"wm/tablet_mode/tablet_mode_controller.h",
"wm/tablet_mode/tablet_mode_event_handler.cc",
"wm/tablet_mode/tablet_mode_event_handler.h",
"wm/tablet_mode/tablet_mode_event_handler_aura.cc",
"wm/tablet_mode/tablet_mode_event_handler_aura.h",
"wm/tablet_mode/tablet_mode_window_manager.cc",
"wm/tablet_mode/tablet_mode_window_manager.h",
"wm/tablet_mode/tablet_mode_window_state.cc",
"wm/tablet_mode/tablet_mode_window_state.h",
"wm/toplevel_window_event_handler.cc",
"wm/toplevel_window_event_handler.h",
"wm/video_detector.cc",
Expand Down Expand Up @@ -921,8 +921,8 @@ component("ash") {
sources -= [
"host/ash_window_tree_host_x11.cc",
"host/ash_window_tree_host_x11.h",
"wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_x11.cc",
"wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_x11.h",
"wm/tablet_mode/scoped_disable_internal_mouse_and_keyboard_x11.cc",
"wm/tablet_mode/scoped_disable_internal_mouse_and_keyboard_x11.h",
]
}

Expand All @@ -934,8 +934,8 @@ component("ash") {
]
} else {
sources -= [
"wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_ozone.cc",
"wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_ozone.h",
"wm/tablet_mode/scoped_disable_internal_mouse_and_keyboard_ozone.cc",
"wm/tablet_mode/scoped_disable_internal_mouse_and_keyboard_ozone.h",
]
}

Expand Down Expand Up @@ -1250,8 +1250,6 @@ source_set("common_unittests") {
"wm/container_finder_unittest.cc",
"wm/immersive_fullscreen_controller_unittest.cc",
"wm/lock_state_controller_unittest.cc",
"wm/maximize_mode/accelerometer_test_data_literals.cc",
"wm/maximize_mode/maximize_mode_window_manager_unittest.cc",
"wm/mru_window_tracker_unittest.cc",
"wm/overlay_event_filter_unittest.cc",
"wm/overview/cleanup_animation_observer_unittest.cc",
Expand All @@ -1264,6 +1262,8 @@ source_set("common_unittests") {
"wm/session_state_animator_impl_unittest.cc",
"wm/stacking_controller_unittest.cc",
"wm/system_modal_container_layout_manager_unittest.cc",
"wm/tablet_mode/accelerometer_test_data_literals.cc",
"wm/tablet_mode/tablet_mode_window_manager_unittest.cc",
"wm/toplevel_window_event_handler_unittest.cc",
"wm/video_detector_unittest.cc",
"wm/window_animations_unittest.cc",
Expand Down Expand Up @@ -1403,7 +1403,7 @@ test("ash_unittests") {
"wm/lock_layout_manager_unittest.cc",

# TODO: investigate failures in mash. http://crbug.com/698092.
"wm/maximize_mode/maximize_mode_controller_unittest.cc",
"wm/tablet_mode/tablet_mode_controller_unittest.cc",

# TODO: mash doesn't support CursorManager. http://crbug.com/631103.
"wm/resize_shadow_and_cursor_unittest.cc",
Expand Down
1 change: 0 additions & 1 deletion ash/accelerators/accelerator_controller_delegate_aura.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "ash/system/system_notifier.h"
#include "ash/touch/touch_hud_debug.h"
#include "ash/utility/screenshot_controller.h"
#include "ash/wm/maximize_mode/maximize_mode_controller.h"
#include "ash/wm/power_button_controller.h"
#include "ash/wm/window_state.h"
#include "ash/wm/wm_event.h"
Expand Down
8 changes: 4 additions & 4 deletions ash/accelerators/debug_commands.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "ash/system/toast/toast_manager.h"
#include "ash/wallpaper/wallpaper_controller.h"
#include "ash/wallpaper/wallpaper_delegate.h"
#include "ash/wm/maximize_mode/maximize_mode_controller.h"
#include "ash/wm/tablet_mode/tablet_mode_controller.h"
#include "ash/wm/widget_finder.h"
#include "ash/wm/window_properties.h"
#include "ash/wm/window_util.h"
Expand Down Expand Up @@ -146,9 +146,9 @@ void HandleToggleTouchscreen() {
}

void HandleToggleTouchView() {
MaximizeModeController* controller = Shell::Get()->maximize_mode_controller();
controller->EnableMaximizeModeWindowManager(
!controller->IsMaximizeModeWindowManagerEnabled());
TabletModeController* controller = Shell::Get()->tablet_mode_controller();
controller->EnableTabletModeWindowManager(
!controller->IsTabletModeWindowManagerEnabled());
}

void HandleTriggerCrash() {
Expand Down
2 changes: 1 addition & 1 deletion ash/app_list/app_list_presenter_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "ash/shelf/shelf_widget.h"
#include "ash/shell.h"
#include "ash/shell_port.h"
#include "ash/wm/maximize_mode/maximize_mode_controller.h"
#include "ash/wm/tablet_mode/tablet_mode_controller.h"
#include "ash/wm_window.h"
#include "base/command_line.h"
#include "ui/app_list/app_list_constants.h"
Expand Down
14 changes: 7 additions & 7 deletions ash/aura/shell_port_classic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
#include "ash/touch/touch_uma.h"
#include "ash/virtual_keyboard_controller.h"
#include "ash/wm/drag_window_resizer.h"
#include "ash/wm/maximize_mode/maximize_mode_event_handler_aura.h"
#include "ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard.h"
#include "ash/wm/mru_window_tracker.h"
#include "ash/wm/overview/window_selector_controller.h"
#include "ash/wm/tablet_mode/scoped_disable_internal_mouse_and_keyboard.h"
#include "ash/wm/tablet_mode/tablet_mode_event_handler_aura.h"
#include "ash/wm/window_cycle_event_filter_aura.h"
#include "ash/wm/window_util.h"
#include "ash/wm/workspace/workspace_event_handler_aura.h"
Expand All @@ -42,12 +42,12 @@
#include "ui/display/types/native_display_delegate.h"

#if defined(USE_X11)
#include "ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_x11.h"
#include "ash/wm/tablet_mode/scoped_disable_internal_mouse_and_keyboard_x11.h"
#include "ui/display/manager/chromeos/x11/native_display_delegate_x11.h"
#endif

#if defined(USE_OZONE)
#include "ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_ozone.h"
#include "ash/wm/tablet_mode/scoped_disable_internal_mouse_and_keyboard_ozone.h"
#include "ui/display/types/native_display_delegate.h"
#include "ui/ozone/public/ozone_platform.h"
#endif
Expand Down Expand Up @@ -185,9 +185,9 @@ ShellPortClassic::CreateWindowCycleEventFilter() {
return base::MakeUnique<WindowCycleEventFilterAura>();
}

std::unique_ptr<wm::MaximizeModeEventHandler>
ShellPortClassic::CreateMaximizeModeEventHandler() {
return base::WrapUnique(new wm::MaximizeModeEventHandlerAura);
std::unique_ptr<wm::TabletModeEventHandler>
ShellPortClassic::CreateTabletModeEventHandler() {
return base::WrapUnique(new wm::TabletModeEventHandlerAura);
}

std::unique_ptr<WorkspaceEventHandler>
Expand Down
2 changes: 1 addition & 1 deletion ash/aura/shell_port_classic.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class ASH_EXPORT ShellPortClassic : public ShellPort,
wm::WindowState* window_state) override;
std::unique_ptr<WindowCycleEventFilter> CreateWindowCycleEventFilter()
override;
std::unique_ptr<wm::MaximizeModeEventHandler> CreateMaximizeModeEventHandler()
std::unique_ptr<wm::TabletModeEventHandler> CreateTabletModeEventHandler()
override;
std::unique_ptr<WorkspaceEventHandler> CreateWorkspaceEventHandler(
WmWindow* workspace_window) override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "ash/test/screen_orientation_controller_test_api.h"
#include "ash/test/test_shell_delegate.h"
#include "ash/test/test_system_tray_delegate.h"
#include "ash/wm/maximize_mode/maximize_mode_controller.h"
#include "ash/wm/tablet_mode/tablet_mode_controller.h"
#include "ash/wm/window_state.h"
#include "ash/wm_window.h"
#include "base/command_line.h"
Expand Down Expand Up @@ -56,9 +56,8 @@ display::ManagedDisplayInfo CreateDisplayInfo(int64_t id,
return info;
}

void EnableMaximizeMode(bool enable) {
Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager(
enable);
void EnableTabletMode(bool enable) {
Shell::Get()->tablet_mode_controller()->EnableTabletModeWindowManager(enable);
}

bool RotationLocked() {
Expand Down Expand Up @@ -360,7 +359,7 @@ TEST_F(ScreenOrientationControllerTest, WindowDestructionRemovesLock) {
// Tests that accelerometer readings in each of the screen angles will trigger a
// rotation of the internal display.
TEST_F(ScreenOrientationControllerTest, DisplayRotation) {
EnableMaximizeMode(true);
EnableTabletMode(true);
// Now test rotating in all directions.
TriggerLidUpdate(gfx::Vector3dF(-kMeanGravity, 0.0f, 0.0f));
EXPECT_EQ(display::Display::ROTATE_90, GetCurrentInternalDisplayRotation());
Expand All @@ -375,7 +374,7 @@ TEST_F(ScreenOrientationControllerTest, DisplayRotation) {
// Tests that low angles are ignored by the accelerometer (i.e. when the device
// is almost laying flat).
TEST_F(ScreenOrientationControllerTest, RotationIgnoresLowAngles) {
EnableMaximizeMode(true);
EnableTabletMode(true);
TriggerLidUpdate(gfx::Vector3dF(0.0f, -kMeanGravity, -kMeanGravity));
EXPECT_EQ(display::Display::ROTATE_0, GetCurrentInternalDisplayRotation());
TriggerLidUpdate(gfx::Vector3dF(-2.0f, 0.0f, -kMeanGravity));
Expand All @@ -391,7 +390,7 @@ TEST_F(ScreenOrientationControllerTest, RotationIgnoresLowAngles) {
// Tests that the display will stick to the current orientation beyond the
// halfway point, preventing frequent updates back and forth.
TEST_F(ScreenOrientationControllerTest, RotationSticky) {
EnableMaximizeMode(true);
EnableTabletMode(true);
gfx::Vector3dF gravity(0.0f, -kMeanGravity, 0.0f);
TriggerLidUpdate(gravity);
EXPECT_EQ(display::Display::ROTATE_0, GetCurrentInternalDisplayRotation());
Expand Down Expand Up @@ -423,7 +422,7 @@ TEST_F(ScreenOrientationControllerTest, RotationSticky) {
// Tests that the display will stick to its current orientation when the
// rotation lock has been set.
TEST_F(ScreenOrientationControllerTest, RotationLockPreventsRotation) {
EnableMaximizeMode(true);
EnableTabletMode(true);
SetUserRotationLocked(true);

// Turn past the threshold for rotation.
Expand All @@ -444,7 +443,7 @@ TEST_F(ScreenOrientationControllerTest, RotationLockPreventsRotation) {
// Tests that the screen rotation notifications are suppressed when
// triggered by the accelerometer.
TEST_F(ScreenOrientationControllerTest, BlockRotationNotifications) {
EnableMaximizeMode(true);
EnableTabletMode(true);
Shell::Get()->screen_layout_observer()->set_show_notifications_for_testing(
true);
display::test::DisplayManagerTestApi(display_manager())
Expand All @@ -457,7 +456,7 @@ TEST_F(ScreenOrientationControllerTest, BlockRotationNotifications) {
EXPECT_FALSE(message_center->HasPopupNotifications());

// Make sure notifications are still displayed when
// adjusting the screen rotation directly when in maximize mode
// adjusting the screen rotation directly when in tablet mode
ASSERT_NE(display::Display::ROTATE_270, GetCurrentInternalDisplayRotation());
SetInternalDisplayRotation(display::Display::ROTATE_270);
SetSystemRotationLocked(false);
Expand All @@ -472,7 +471,7 @@ TEST_F(ScreenOrientationControllerTest, BlockRotationNotifications) {
EXPECT_FALSE(message_center->HasPopupNotifications());

// Make sure notifications are blocked when adjusting the screen rotation
// via the accelerometer while in maximize mode
// via the accelerometer while in tablet mode
// Rotate the screen 90 degrees
ASSERT_EQ(display::Display::ROTATE_270, GetCurrentInternalDisplayRotation());
TriggerLidUpdate(gfx::Vector3dF(-kMeanGravity, 0.0f, 0.0f));
Expand All @@ -481,8 +480,8 @@ TEST_F(ScreenOrientationControllerTest, BlockRotationNotifications) {
EXPECT_FALSE(message_center->HasPopupNotifications());

// Make sure notifications are still displayed when
// adjusting the screen rotation directly when not in maximize mode
EnableMaximizeMode(false);
// adjusting the screen rotation directly when not in tablet mode
EnableTabletMode(false);
// Reset the screen rotation.
SetInternalDisplayRotation(display::Display::ROTATE_0);
// Clear all notifications
Expand All @@ -498,41 +497,41 @@ TEST_F(ScreenOrientationControllerTest, BlockRotationNotifications) {
}

// Tests that if a user has set a display rotation that it is restored upon
// exiting maximize mode.
// exiting tablet mode.
TEST_F(ScreenOrientationControllerTest, ResetUserRotationUponExit) {
display::test::DisplayManagerTestApi(display_manager())
.SetFirstDisplayAsInternalDisplay();

SetInternalDisplayRotation(display::Display::ROTATE_90);
EnableMaximizeMode(true);
EnableTabletMode(true);

TriggerLidUpdate(gfx::Vector3dF(0.0f, kMeanGravity, 0.0f));
EXPECT_EQ(display::Display::ROTATE_180, GetCurrentInternalDisplayRotation());

EnableMaximizeMode(false);
EnableTabletMode(false);
EXPECT_EQ(display::Display::ROTATE_90, GetCurrentInternalDisplayRotation());
}

// Tests that if a user sets a display rotation that accelerometer rotation
// becomes locked.
TEST_F(ScreenOrientationControllerTest,
NonAccelerometerRotationChangesLockRotation) {
EnableMaximizeMode(true);
EnableTabletMode(true);
ASSERT_FALSE(RotationLocked());
SetInternalDisplayRotation(display::Display::ROTATE_270);
EXPECT_TRUE(RotationLocked());
}

// Tests that if a user changes the display rotation, while rotation is locked,
// that the updates are recorded. Upon exiting maximize mode the latest user
// that the updates are recorded. Upon exiting tablet mode the latest user
// rotation should be applied.
TEST_F(ScreenOrientationControllerTest, UpdateUserRotationWhileRotationLocked) {
EnableMaximizeMode(true);
EnableTabletMode(true);
SetInternalDisplayRotation(display::Display::ROTATE_270);
// User sets rotation to the same rotation that the display was at when
// maximize mode was activated.
// tablet mode was activated.
SetInternalDisplayRotation(display::Display::ROTATE_0);
EnableMaximizeMode(false);
EnableTabletMode(false);
EXPECT_EQ(display::Display::ROTATE_0, GetCurrentInternalDisplayRotation());
}

Expand All @@ -541,7 +540,7 @@ TEST_F(ScreenOrientationControllerTest, UpdateUserRotationWhileRotationLocked) {
TEST_F(ScreenOrientationControllerTest, LandscapeOrientationAllowsRotation) {
std::unique_ptr<content::WebContents> content(CreateWebContents());
std::unique_ptr<aura::Window> focus_window(CreateAppWindowInShellWithId(0));
EnableMaximizeMode(true);
EnableTabletMode(true);

AttachAndActivateWebContents(content.get(), focus_window.get());
delegate()->Lock(content.get(), blink::kWebScreenOrientationLockLandscape);
Expand All @@ -564,7 +563,7 @@ TEST_F(ScreenOrientationControllerTest, LandscapeOrientationAllowsRotation) {
TEST_F(ScreenOrientationControllerTest, PortraitOrientationAllowsRotation) {
std::unique_ptr<content::WebContents> content(CreateWebContents());
std::unique_ptr<aura::Window> focus_window(CreateAppWindowInShellWithId(0));
EnableMaximizeMode(true);
EnableTabletMode(true);

AttachAndActivateWebContents(content.get(), focus_window.get());
delegate()->Lock(content.get(), blink::kWebScreenOrientationLockPortrait);
Expand All @@ -587,7 +586,7 @@ TEST_F(ScreenOrientationControllerTest, PortraitOrientationAllowsRotation) {
TEST_F(ScreenOrientationControllerTest, OrientationLockDisallowsRotation) {
std::unique_ptr<content::WebContents> content(CreateWebContents());
std::unique_ptr<aura::Window> focus_window(CreateAppWindowInShellWithId(0));
EnableMaximizeMode(true);
EnableTabletMode(true);

AttachAndActivateWebContents(content.get(), focus_window.get());
delegate()->Lock(content.get(),
Expand All @@ -609,7 +608,7 @@ TEST_F(ScreenOrientationControllerTest, OrientationLockDisallowsRotation) {
TEST_F(ScreenOrientationControllerTest, UserRotationLockDisallowsRotation) {
std::unique_ptr<content::WebContents> content(CreateWebContents());
std::unique_ptr<aura::Window> focus_window(CreateAppWindowInShellWithId(0));
EnableMaximizeMode(true);
EnableTabletMode(true);

AttachAndActivateWebContents(content.get(), focus_window.get());
delegate()->Lock(content.get(), blink::kWebScreenOrientationLockLandscape);
Expand All @@ -624,7 +623,7 @@ TEST_F(ScreenOrientationControllerTest, UserRotationLockDisallowsRotation) {
EXPECT_EQ(display::Display::ROTATE_0, GetCurrentInternalDisplayRotation());
}

// Tests that when MaximizeMode is triggered before the internal display is
// Tests that when TabletMode is triggered before the internal display is
// ready, that ScreenOrientationController still begins listening to events,
// which require an internal display to be acted upon.
TEST_F(ScreenOrientationControllerTest, InternalDisplayNotAvailableAtStartup) {
Expand All @@ -634,7 +633,7 @@ TEST_F(ScreenOrientationControllerTest, InternalDisplayNotAvailableAtStartup) {
int64_t internal_display_id = display::Display::InternalDisplayId();
display::Display::SetInternalDisplayId(display::kInvalidDisplayId);

EnableMaximizeMode(true);
EnableTabletMode(true);

// Should not crash, even though there is no internal display.
SetDisplayRotationById(internal_display_id, display::Display::ROTATE_180);
Expand Down
Loading

0 comments on commit 0827cd5

Please sign in to comment.