diff options
-rw-r--r-- | ash/accelerators/accelerator_controller.cc | 14 | ||||
-rw-r--r-- | ash/accelerators/accelerator_table.cc | 4 | ||||
-rw-r--r-- | ash/accelerators/accelerator_table.h | 1 | ||||
-rw-r--r-- | ash/ash_switches.cc | 3 | ||||
-rw-r--r-- | ash/ash_switches.h | 1 | ||||
-rw-r--r-- | ash/shell.cc | 4 | ||||
-rw-r--r-- | ash/shell.h | 3 | ||||
-rw-r--r-- | ash/wm/maximize_mode/maximize_mode_window_manager.cc | 30 | ||||
-rw-r--r-- | ash/wm/maximize_mode/maximize_mode_window_manager.h | 4 | ||||
-rw-r--r-- | chrome/app/generated_resources.grd | 6 | ||||
-rw-r--r-- | chrome/browser/about_flags.cc | 6 |
11 files changed, 63 insertions, 13 deletions
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc index 6961999..5f068a9 100644 --- a/ash/accelerators/accelerator_controller.cc +++ b/ash/accelerators/accelerator_controller.cc @@ -655,6 +655,18 @@ bool HandleToggleSpokenFeedback() { return true; } +bool HandleToggleTouchViewTesting() { + // TODO(skuhne): This is only temporary! Remove this! + if (CommandLine::ForCurrentProcess()->HasSwitch( + switches::kAshEnableTouchViewTesting)) { + Shell* shell = Shell::GetInstance(); + shell->EnableMaximizeModeWindowManager( + !shell->IsMaximizeModeWindowManagerEnabled()); + return true; + } + return false; +} + bool HandleTouchHudClear() { internal::RootWindowController* controller = internal::RootWindowController::ForTargetRootWindow(); @@ -948,6 +960,8 @@ bool AcceleratorController::PerformAction(int action, return HandleCycleUser(SessionStateDelegate::CYCLE_TO_PREVIOUS_USER); case TOGGLE_SPOKEN_FEEDBACK: return HandleToggleSpokenFeedback(); + case TOGGLE_TOUCH_VIEW_TESTING: + return HandleToggleTouchViewTesting(); case TOGGLE_WIFI: Shell::GetInstance()->system_tray_notifier()->NotifyRequestToggleWifi(); return true; diff --git a/ash/accelerators/accelerator_table.cc b/ash/accelerators/accelerator_table.cc index c6c484a..a099dcc 100644 --- a/ash/accelerators/accelerator_table.cc +++ b/ash/accelerators/accelerator_table.cc @@ -85,6 +85,10 @@ const AcceleratorData kAcceleratorData[] = { SWITCH_TO_PREVIOUS_USER }, { true, ui::VKEY_OEM_PERIOD, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN, SWITCH_TO_NEXT_USER }, + // Turning the TouchView maximizing mode on via hotkey for the time being. + // TODO(skuhne): Remove once the test isn't needed anymore. + { true, ui::VKEY_D, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN | ui::EF_SHIFT_DOWN, + TOGGLE_TOUCH_VIEW_TESTING }, #endif // defined(OS_CHROMEOS) { true, ui::VKEY_I, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN, OPEN_FEEDBACK_PAGE }, #if !defined(OS_WIN) diff --git a/ash/accelerators/accelerator_table.h b/ash/accelerators/accelerator_table.h index 2c88bfc..f34b2df 100644 --- a/ash/accelerators/accelerator_table.h +++ b/ash/accelerators/accelerator_table.h @@ -115,6 +115,7 @@ enum AcceleratorAction { TOGGLE_MAXIMIZED, TOGGLE_ROOT_WINDOW_FULL_SCREEN, TOGGLE_SPOKEN_FEEDBACK, + TOGGLE_TOUCH_VIEW_TESTING, TOGGLE_WIFI, TOUCH_HUD_CLEAR, TOUCH_HUD_MODE_CHANGE, diff --git a/ash/ash_switches.cc b/ash/ash_switches.cc index 5178e81..c03d830 100644 --- a/ash/ash_switches.cc +++ b/ash/ash_switches.cc @@ -122,6 +122,9 @@ const char kAshEnableMultiUserTray[] = "ash-enable-multi-user-tray"; // Enables software based mirroring. const char kAshEnableSoftwareMirroring[] = "ash-enable-software-mirroring"; +// Enables touch view testing. +const char kAshEnableTouchViewTesting[] = "ash-enable-touch-view-testing"; + // When this flag is set, system sounds will be played whether the // ChromeVox is enabled or not. const char kAshEnableSystemSounds[] = "ash-enable-system-sounds"; diff --git a/ash/ash_switches.h b/ash/ash_switches.h index 1b8fdd1..93e86aa 100644 --- a/ash/ash_switches.h +++ b/ash/ash_switches.h @@ -52,6 +52,7 @@ ASH_EXPORT extern const char kAshEnableMultiUserTray[]; #endif ASH_EXPORT extern const char kAshEnableSoftwareMirroring[]; ASH_EXPORT extern const char kAshEnableSystemSounds[]; +ASH_EXPORT extern const char kAshEnableTouchViewTesting[]; ASH_EXPORT extern const char kAshEnableTrayDragging[]; ASH_EXPORT extern const char kAshForceMirrorMode[]; ASH_EXPORT extern const char kAshGuestWallpaperLarge[]; diff --git a/ash/shell.cc b/ash/shell.cc index d86056c..8fc65a7 100644 --- a/ash/shell.cc +++ b/ash/shell.cc @@ -437,6 +437,10 @@ void Shell::EnableMaximizeModeWindowManager(bool enable) { } } +bool Shell::IsMaximizeModeWindowManagerEnabled() { + return maximize_mode_window_manager_.get() != NULL; +} + void Shell::UpdateShelfVisibility() { RootWindowControllerList controllers = GetAllRootWindowControllers(); for (RootWindowControllerList::iterator iter = controllers.begin(); diff --git a/ash/shell.h b/ash/shell.h index 1d58b39..02aaef3 100644 --- a/ash/shell.h +++ b/ash/shell.h @@ -311,6 +311,9 @@ class ASH_EXPORT Shell // Turn the always maximize mode window manager on or off. void EnableMaximizeModeWindowManager(bool enable); + // Test if the MaximizeModeWindowManager is enabled or not. + bool IsMaximizeModeWindowManagerEnabled(); + keyboard::KeyboardController* keyboard_controller() { return keyboard_controller_.get(); } diff --git a/ash/wm/maximize_mode/maximize_mode_window_manager.cc b/ash/wm/maximize_mode/maximize_mode_window_manager.cc index 6360450..a265bdb 100644 --- a/ash/wm/maximize_mode/maximize_mode_window_manager.cc +++ b/ash/wm/maximize_mode/maximize_mode_window_manager.cc @@ -58,13 +58,11 @@ void MaximizeModeWindowManager::OnDisplayBoundsChanged( } void MaximizeModeWindowManager::OnDisplayAdded(const gfx::Display& display) { - RemoveWindowCreationObservers(); - AddWindowCreationObservers(); - + DisplayConfigurationChanged(); } + void MaximizeModeWindowManager::OnDisplayRemoved(const gfx::Display& display) { - RemoveWindowCreationObservers(); - AddWindowCreationObservers(); + DisplayConfigurationChanged(); } MaximizeModeWindowManager::MaximizeModeWindowManager() { @@ -133,14 +131,15 @@ void MaximizeModeWindowManager::RestoreAndForgetWindow( if (!CanMaximize(window)) { // TODO(skuhne): Remove the background cover layer. ash::wm::WindowState* window_state = ash::wm::GetWindowState(window); - DCHECK(window_state->HasRestoreBounds()); - gfx::Rect initial_bounds = - window->parent() ? window_state->GetRestoreBoundsInParent() : - window_state->GetRestoreBoundsInScreen(); - window_state->ClearRestoreBounds(); - // TODO(skuhne): The screen might have changed and we should make it - // visible area again. - window->SetBounds(initial_bounds); + if (window_state->HasRestoreBounds()) { + gfx::Rect initial_bounds = + window->parent() ? window_state->GetRestoreBoundsInParent() : + window_state->GetRestoreBoundsInScreen(); + window_state->ClearRestoreBounds(); + // TODO(skuhne): The screen might have changed and we should make sure + // that the bounds are in a visible area. + window->SetBounds(initial_bounds); + } } else { // If the window neither was minimized or maximized and it is currently // not minimized, we restore it. @@ -213,6 +212,11 @@ void MaximizeModeWindowManager::RemoveWindowCreationObservers() { observed_container_windows_.clear(); } +void MaximizeModeWindowManager::DisplayConfigurationChanged() { + RemoveWindowCreationObservers(); + AddWindowCreationObservers(); +} + bool MaximizeModeWindowManager::IsContainerWindow(aura::Window* window) { return observed_container_windows_.find(window) != observed_container_windows_.end(); diff --git a/ash/wm/maximize_mode/maximize_mode_window_manager.h b/ash/wm/maximize_mode/maximize_mode_window_manager.h index 7b0c1db6..40ff930 100644 --- a/ash/wm/maximize_mode/maximize_mode_window_manager.h +++ b/ash/wm/maximize_mode/maximize_mode_window_manager.h @@ -91,6 +91,10 @@ class ASH_EXPORT MaximizeModeWindowManager : public aura::WindowObserver, // Remove Window creation observers. void RemoveWindowCreationObservers(); + // Change the internal state (e.g. observers) when the display configuration + // changes. + void DisplayConfigurationChanged(); + // Returns true when the |window| is a container window. bool IsContainerWindow(aura::Window* window); diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index ee07127..bf3c767 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -6330,6 +6330,12 @@ Keep your key file in a safe place. You will need it to create new versions of y <message name="IDS_FLAGS_DND_APPLIST_TO_LAUNCHER_DESCRIPTION" desc="Description for the flag to disable drag and drop opertions from the app list menu to the launcher."> Disallow drag and drop from the App Launcher menu to the shelf. </message> + <message name="IDS_FLAGS_ASH_ENABLE_TOUCH_VIEW_TESTING_NAME" desc="Title for the flag which can be used to test the TouchView maximizing mode."> + Enable TouchView maximizing UI for testing + </message> + <message name="IDS_FLAGS_ASH_ENABLE_TOUCH_VIEW_TESTING_DESCRIPTION" desc="Description for the flag to enable the TouchView testing mode."> + Enable Ctrl+Alt+Shift+D to toggle the TouchView maximizing mode. + </message> <message name="IDS_FLAGS_ENABLE_MEMORY_MONITOR_NAME" desc="Title for the flag to enable advanced gestures."> Enable memory monitor </message> diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index ca27f89..5098fb3 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc @@ -1188,6 +1188,12 @@ const Experiment kExperiments[] = { kOsCrOS, SINGLE_VALUE_TYPE(ash::switches::kAshDisableDragAndDropAppListToLauncher), }, + { "ash-enable-touch-view-testing", + IDS_FLAGS_ASH_ENABLE_TOUCH_VIEW_TESTING_NAME, + IDS_FLAGS_ASH_ENABLE_TOUCH_VIEW_TESTING_DESCRIPTION, + kOsCrOS, + SINGLE_VALUE_TYPE(ash::switches::kAshEnableTouchViewTesting), + }, #if defined(OS_LINUX) { "ash-enable-memory-monitor", IDS_FLAGS_ENABLE_MEMORY_MONITOR_NAME, |