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

Side by Side Diff: ash/common/wm/workspace/workspace_layout_manager.cc

Issue 2180603002: Virtual keyboard - do not change work area of screen if in non-sticky mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/common/wm/workspace/workspace_layout_manager.h" 5 #include "ash/common/wm/workspace/workspace_layout_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
oshima 2016/07/22 23:45:01 new line between c++ include and chrome includes.
hariank 2016/07/27 20:38:38 Done.
8 8 #include "ash/common/ash_switches.h"
9 #include "ash/common/session/session_state_delegate.h" 9 #include "ash/common/session/session_state_delegate.h"
10 #include "ash/common/wm/always_on_top_controller.h" 10 #include "ash/common/wm/always_on_top_controller.h"
11 #include "ash/common/wm/fullscreen_window_finder.h" 11 #include "ash/common/wm/fullscreen_window_finder.h"
12 #include "ash/common/wm/window_positioner.h" 12 #include "ash/common/wm/window_positioner.h"
13 #include "ash/common/wm/window_state.h" 13 #include "ash/common/wm/window_state.h"
14 #include "ash/common/wm/wm_event.h" 14 #include "ash/common/wm/wm_event.h"
15 #include "ash/common/wm/wm_screen_util.h" 15 #include "ash/common/wm/wm_screen_util.h"
16 #include "ash/common/wm/workspace/workspace_layout_manager_backdrop_delegate.h" 16 #include "ash/common/wm/workspace/workspace_layout_manager_backdrop_delegate.h"
17 #include "ash/common/wm/workspace/workspace_layout_manager_delegate.h" 17 #include "ash/common/wm/workspace/workspace_layout_manager_delegate.h"
18 #include "ash/common/wm_root_window_controller.h" 18 #include "ash/common/wm_root_window_controller.h"
19 #include "ash/common/wm_shell.h" 19 #include "ash/common/wm_shell.h"
20 #include "ash/common/wm_window.h" 20 #include "ash/common/wm_window.h"
21 #include "ash/common/wm_window_property.h" 21 #include "ash/common/wm_window_property.h"
22 #include "base/command_line.h"
22 #include "ui/compositor/layer.h" 23 #include "ui/compositor/layer.h"
24 #include "ui/keyboard/keyboard_controller.h"
23 #include "ui/keyboard/keyboard_controller_observer.h" 25 #include "ui/keyboard/keyboard_controller_observer.h"
24 26
25 namespace ash { 27 namespace ash {
26 28
27 WorkspaceLayoutManager::WorkspaceLayoutManager( 29 WorkspaceLayoutManager::WorkspaceLayoutManager(
28 WmWindow* window, 30 WmWindow* window,
29 std::unique_ptr<wm::WorkspaceLayoutManagerDelegate> delegate) 31 std::unique_ptr<wm::WorkspaceLayoutManagerDelegate> delegate)
30 : window_(window), 32 : window_(window),
31 root_window_(window->GetRootWindow()), 33 root_window_(window->GetRootWindow()),
32 root_window_controller_(root_window_->GetRootWindowController()), 34 root_window_controller_(root_window_->GetRootWindowController()),
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 return; 137 return;
136 138
137 window = window->GetToplevelWindow(); 139 window = window->GetToplevelWindow();
138 if (!window_->Contains(window)) 140 if (!window_->Contains(window))
139 return; 141 return;
140 142
141 wm::WindowState* window_state = window->GetWindowState(); 143 wm::WindowState* window_state = window->GetWindowState();
142 if (window_state->ignore_keyboard_bounds_change()) 144 if (window_state->ignore_keyboard_bounds_change())
143 return; 145 return;
144 146
145 if (!new_bounds.IsEmpty()) { 147 // If new window behavior flag enabled and in non-sticky mode, do not change
148 // the work area.
149 bool change_work_area =
150 (!base::CommandLine::ForCurrentProcess()->HasSwitch(
151 switches::kAshUseNewVKWindowBehavior) ||
152 keyboard::KeyboardController::GetInstance()->get_lock_keyboard());
oshima 2016/07/22 23:45:01 if think this method will be gone with new mode, (
hariank 2016/07/27 20:38:39 Done.
153
154 if (!new_bounds.IsEmpty() && change_work_area) {
146 // Store existing bounds to be restored before resizing for keyboard if it 155 // Store existing bounds to be restored before resizing for keyboard if it
147 // is not already stored. 156 // is not already stored.
148 if (!window_state->HasRestoreBounds()) 157 if (!window_state->HasRestoreBounds())
149 window_state->SaveCurrentBoundsForRestore(); 158 window_state->SaveCurrentBoundsForRestore();
150 159
151 gfx::Rect window_bounds = 160 gfx::Rect window_bounds =
152 window_->ConvertRectToScreen(window->GetTargetBounds()); 161 window_->ConvertRectToScreen(window->GetTargetBounds());
153 int vertical_displacement = 162 int vertical_displacement =
154 std::max(0, window_bounds.bottom() - new_bounds.y()); 163 std::max(0, window_bounds.bottom() - new_bounds.y());
155 int shift = std::min(vertical_displacement, 164 int shift = std::min(vertical_displacement,
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 for (auto* window : windows) { 370 for (auto* window : windows) {
362 wm::WindowState* window_state = window->GetWindowState(); 371 wm::WindowState* window_state = window->GetWindowState();
363 if (window_on_top) 372 if (window_on_top)
364 window_state->DisableAlwaysOnTop(window_on_top); 373 window_state->DisableAlwaysOnTop(window_on_top);
365 else 374 else
366 window_state->RestoreAlwaysOnTop(); 375 window_state->RestoreAlwaysOnTop();
367 } 376 }
368 } 377 }
369 378
370 } // namespace ash 379 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698