diff options
author | flackr@chromium.org <flackr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-24 05:57:52 +0000 |
---|---|---|
committer | flackr@chromium.org <flackr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-24 05:57:52 +0000 |
commit | 0578bfb59485bb09740b611ecb12c059278f300f (patch) | |
tree | ef7339124986b60bfd45f12ce2e47cddf9a08ded /ash | |
parent | 8f547ea7edbf6bfd0d94dea2d9a250af0bc422ab (diff) | |
download | chromium_src-0578bfb59485bb09740b611ecb12c059278f300f.zip chromium_src-0578bfb59485bb09740b611ecb12c059278f300f.tar.gz chromium_src-0578bfb59485bb09740b611ecb12c059278f300f.tar.bz2 |
Use 100ms delay before overview and add a flag for setting the delay.
BUG=310269
TEST=Alt tabbing should very quickly enter overview mode.
Review URL: https://codereview.chromium.org/37273002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@230656 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r-- | ash/ash_switches.cc | 4 | ||||
-rw-r--r-- | ash/ash_switches.h | 1 | ||||
-rw-r--r-- | ash/wm/overview/window_selector.cc | 37 | ||||
-rw-r--r-- | ash/wm/overview/window_selector.h | 1 |
4 files changed, 40 insertions, 3 deletions
diff --git a/ash/ash_switches.cc b/ash/ash_switches.cc index 118f787..5800bbc 100644 --- a/ash/ash_switches.cc +++ b/ash/ash_switches.cc @@ -153,6 +153,10 @@ const char kAshImmersiveHideTabIndicators[] = const char kAshOemWallpaperLarge[] = "ash-oem-wallpaper-large"; const char kAshOemWallpaperSmall[] = "ash-oem-wallpaper-small"; +// Specifies the delay in milliseconds before beginning overview mode after +// getting an alt tab keypress. +const char kAshOverviewDelayOnAltTab[] = "ash-overview-delay-on-alt-tab"; + // Specifies the layout mode and offsets for the secondary display for // testing. The format is "<t|r|b|l>,<offset>" where t=TOP, r=RIGHT, // b=BOTTOM and L=LEFT. For example, 'r,-100' means the secondary display diff --git a/ash/ash_switches.h b/ash/ash_switches.h index 908c897..d502c82 100644 --- a/ash/ash_switches.h +++ b/ash/ash_switches.h @@ -62,6 +62,7 @@ ASH_EXPORT extern const char kAshHostWindowBounds[]; ASH_EXPORT extern const char kAshImmersiveHideTabIndicators[]; ASH_EXPORT extern const char kAshOemWallpaperLarge[]; ASH_EXPORT extern const char kAshOemWallpaperSmall[]; +ASH_EXPORT extern const char kAshOverviewDelayOnAltTab[]; ASH_EXPORT extern const char kAshSecondaryDisplayLayout[]; ASH_EXPORT extern const char kAshTouchHud[]; ASH_EXPORT extern const char kAshUseAlternateShelfLayout[]; diff --git a/ash/wm/overview/window_selector.cc b/ash/wm/overview/window_selector.cc index 47d3c49..e23f5b3 100644 --- a/ash/wm/overview/window_selector.cc +++ b/ash/wm/overview/window_selector.cc @@ -6,6 +6,7 @@ #include <algorithm> +#include "ash/ash_switches.h" #include "ash/root_window_controller.h" #include "ash/shell.h" #include "ash/wm/mru_window_tracker.h" @@ -15,7 +16,9 @@ #include "ash/wm/overview/window_selector_window.h" #include "ash/wm/window_state.h" #include "base/auto_reset.h" +#include "base/command_line.h" #include "base/metrics/histogram.h" +#include "base/strings/string_number_conversions.h" #include "base/timer/timer.h" #include "ui/aura/client/activation_client.h" #include "ui/aura/client/focus_client.h" @@ -29,7 +32,29 @@ namespace ash { namespace { -const int kOverviewDelayOnCycleMilliseconds = 500; +// The time from when the user pressed alt+tab while still holding alt before +// overview is engaged. +const int kOverviewDelayOnCycleMilliseconds = 100; + +// The maximum amount of time allowed for the delay before overview on cycling. +// If the specified time exceeds this the timer will not be started. +const int kMaxOverviewDelayOnCycleMilliseconds = 10000; + +int GetOverviewDelayOnCycleMilliseconds() { + static int value = -1; + if (value == -1) { + value = kOverviewDelayOnCycleMilliseconds; + if (CommandLine::ForCurrentProcess()->HasSwitch( + switches::kAshOverviewDelayOnAltTab)) { + if (!base::StringToInt(CommandLine::ForCurrentProcess()-> + GetSwitchValueASCII(switches::kAshOverviewDelayOnAltTab), &value)) { + LOG(ERROR) << "Expected int value for " + << switches::kAshOverviewDelayOnAltTab; + } + } + } + return value; +} // A comparator for locating a given target window. struct WindowSelectorItemComparator @@ -209,8 +234,11 @@ WindowSelector::WindowSelector(const WindowList& windows, WindowSelector::Mode mode, WindowSelectorDelegate* delegate) : mode_(mode), + timer_enabled_(GetOverviewDelayOnCycleMilliseconds() < + kMaxOverviewDelayOnCycleMilliseconds), start_overview_timer_(FROM_HERE, - base::TimeDelta::FromMilliseconds(kOverviewDelayOnCycleMilliseconds), + base::TimeDelta::FromMilliseconds( + GetOverviewDelayOnCycleMilliseconds()), this, &WindowSelector::StartOverview), delegate_(delegate), selected_window_(0), @@ -259,7 +287,8 @@ WindowSelector::WindowSelector(const WindowList& windows, if (mode == WindowSelector::CYCLE) { event_handler_.reset(new WindowSelectorEventFilter(this)); - start_overview_timer_.Reset(); + if (timer_enabled_) + start_overview_timer_.Reset(); } else { StartOverview(); } @@ -307,6 +336,8 @@ void WindowSelector::Step(WindowSelector::Direction direction) { showing_window_.reset(new ScopedShowWindow); showing_window_->Show(windows_[selected_window_]->SelectionWindow()); start_overview_timer_.Reset(); + if (timer_enabled_) + start_overview_timer_.Reset(); } } diff --git a/ash/wm/overview/window_selector.h b/ash/wm/overview/window_selector.h index 2f178b6..4fc29d1 100644 --- a/ash/wm/overview/window_selector.h +++ b/ash/wm/overview/window_selector.h @@ -117,6 +117,7 @@ class ASH_EXPORT WindowSelector // of the stacking order and made visible). scoped_ptr<ScopedShowWindow> showing_window_; + bool timer_enabled_; base::DelayTimer<WindowSelector> start_overview_timer_; scoped_ptr<WindowOverview> window_overview_; |