Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2531)

Unified Diff: ash/common/wm/window_cycle_list.cc

Issue 2249583002: Revert "Enable ash window cycle UI by default." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/common/wm/window_cycle_list.h ('k') | ash/wm/window_cycle_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/wm/window_cycle_list.cc
diff --git a/ash/common/wm/window_cycle_list.cc b/ash/common/wm/window_cycle_list.cc
index 845dcaa5d21059b9b6806c50a3a8db1944eea0c4..2c0ec797d0bb825fdd3e487b7947a5ec845bb4d6 100644
--- a/ash/common/wm/window_cycle_list.cc
+++ b/ash/common/wm/window_cycle_list.cc
@@ -30,10 +30,6 @@
namespace ash {
-namespace {
-
-bool g_disable_initial_delay = false;
-
// Returns the window immediately below |window| in the current container.
WmWindow* GetWindowBelow(WmWindow* window) {
WmWindow* parent = window->GetParent();
@@ -65,8 +61,6 @@ class LayerFillBackgroundPainter : public views::Background {
DISALLOW_COPY_AND_ASSIGN(LayerFillBackgroundPainter);
};
-} // namespace
-
// This class restores and moves a window to the front of the stacking order for
// the duration of the class's scope.
class ScopedShowWindow : public WmWindowObserver {
@@ -308,28 +302,16 @@ class WindowCycleView : public views::WidgetDelegateView {
target_window_ = target;
if (GetWidget()) {
Layout();
- if (target_window_) {
- // In the window destruction case, we may have already removed the
- // focused view and hence not be the focused window. We should still
- // always be active, though.
- DCHECK_EQ(ash::WmShell::Get()->GetActiveWindow()->GetInternalWidget(),
- GetWidget());
- window_view_map_[target_window_]->RequestFocus();
- }
+ DCHECK(Contains(GetFocusManager()->GetFocusedView()));
+ window_view_map_[target_window_]->RequestFocus();
}
}
void HandleWindowDestruction(WmWindow* destroying_window,
WmWindow* new_target) {
auto view_iter = window_view_map_.find(destroying_window);
- views::View* parent = view_iter->second->parent();
- DCHECK_EQ(mirror_container_, parent);
- parent->RemoveChildView(view_iter->second);
+ view_iter->second->parent()->RemoveChildView(view_iter->second);
window_view_map_.erase(view_iter);
- // With one of its children now gone, we must re-layout |mirror_container_|.
- // This must happen before SetTargetWindow() to make sure our own Layout()
- // works correctly when it's calculating highlight bounds.
- parent->Layout();
SetTargetWindow(new_target);
}
@@ -433,26 +415,19 @@ void ScopedShowWindow::OnWindowTreeChanging(WmWindow* window,
WindowCycleList::WindowCycleList(const WindowList& windows)
: windows_(windows), current_index_(0), cycle_view_(nullptr) {
- if (!ShouldShowUi())
- WmShell::Get()->mru_window_tracker()->SetIgnoreActivations(true);
+ WmShell::Get()->mru_window_tracker()->SetIgnoreActivations(true);
for (WmWindow* window : windows_)
window->AddObserver(this);
if (ShouldShowUi()) {
- if (g_disable_initial_delay) {
- InitWindowCycleView();
- } else {
- show_ui_timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(150),
- this, &WindowCycleList::InitWindowCycleView);
- }
+ show_ui_timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(150),
+ this, &WindowCycleList::InitWindowCycleView);
}
}
WindowCycleList::~WindowCycleList() {
- if (!ShouldShowUi())
- WmShell::Get()->mru_window_tracker()->SetIgnoreActivations(false);
-
+ WmShell::Get()->mru_window_tracker()->SetIgnoreActivations(false);
for (WmWindow* window : windows_)
window->RemoveObserver(this);
@@ -500,11 +475,6 @@ void WindowCycleList::Step(WindowCycleController::Direction direction) {
}
}
-// static
-void WindowCycleList::DisableInitialDelayForTesting() {
- g_disable_initial_delay = true;
-}
-
void WindowCycleList::OnWindowDestroying(WmWindow* window) {
window->RemoveObserver(this);
@@ -531,7 +501,9 @@ void WindowCycleList::OnWindowDestroying(WmWindow* window) {
}
bool WindowCycleList::ShouldShowUi() {
- return windows_.size() > 1;
+ return windows_.size() > 1 &&
+ base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kAshEnableWindowCycleUi);
}
void WindowCycleList::InitWindowCycleView() {
« no previous file with comments | « ash/common/wm/window_cycle_list.h ('k') | ash/wm/window_cycle_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698