summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authorskuhne@chromium.org <skuhne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-26 05:34:34 +0000
committerskuhne@chromium.org <skuhne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-26 05:34:34 +0000
commitb19b09acc83a0384520764570f643dda129f804a (patch)
tree97da591d723add9fceb0b4abf6a216189addce9c /ash
parentd05cf2f1ab93b70f152cb673a102ef2d0e125a72 (diff)
downloadchromium_src-b19b09acc83a0384520764570f643dda129f804a.zip
chromium_src-b19b09acc83a0384520764570f643dda129f804a.tar.gz
chromium_src-b19b09acc83a0384520764570f643dda129f804a.tar.bz2
Adding hotkey behind a commandline to allow testing the TouchView maximizing mode.
The flag and the hotkey is only temporary since there is no other way to test the TouchView functionality at this time. BUG=337563 TEST=visual Review URL: https://codereview.chromium.org/179063002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@253369 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/accelerators/accelerator_controller.cc14
-rw-r--r--ash/accelerators/accelerator_table.cc4
-rw-r--r--ash/accelerators/accelerator_table.h1
-rw-r--r--ash/ash_switches.cc3
-rw-r--r--ash/ash_switches.h1
-rw-r--r--ash/shell.cc4
-rw-r--r--ash/shell.h3
-rw-r--r--ash/wm/maximize_mode/maximize_mode_window_manager.cc30
-rw-r--r--ash/wm/maximize_mode/maximize_mode_window_manager.h4
9 files changed, 51 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);