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

Unified Diff: ash/shelf/shelf_layout_manager.cc

Issue 2200963002: ShelfLayoutManager 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: ShelfLayoutManager virtual keyboard - do not change work area of screen if in non-sticky mode. 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
Index: ash/shelf/shelf_layout_manager.cc
diff --git a/ash/shelf/shelf_layout_manager.cc b/ash/shelf/shelf_layout_manager.cc
index 512b88fa38575a97ad9ecccc7c55e693f860f42c..c0c3ee2cab7da31eedcdd747b1500e451f1fb74a 100644
--- a/ash/shelf/shelf_layout_manager.cc
+++ b/ash/shelf/shelf_layout_manager.cc
@@ -8,6 +8,7 @@
#include <cmath>
#include <vector>
+#include "ash/common/ash_switches.h"
#include "ash/common/material_design/material_design_controller.h"
#include "ash/common/session/session_state_delegate.h"
#include "ash/common/shelf/shelf_constants.h"
@@ -32,6 +33,7 @@
#include "ash/wm/window_animations.h"
#include "ash/wm/workspace_controller.h"
#include "base/auto_reset.h"
+#include "base/command_line.h"
#include "base/i18n/rtl.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/layer_animation_observer.h"
@@ -41,6 +43,7 @@
#include "ui/display/screen.h"
#include "ui/events/event.h"
#include "ui/events/event_handler.h"
+#include "ui/keyboard/keyboard_controller.h"
#include "ui/keyboard/keyboard_util.h"
#include "ui/views/border.h"
#include "ui/views/widget/widget.h"
@@ -264,16 +267,20 @@ gfx::Size ShelfLayoutManager::GetPreferredSize() {
return target_bounds.shelf_bounds_in_root.size();
}
-void ShelfLayoutManager::LayoutShelf() {
+void ShelfLayoutManager::LayoutShelfAndUpdateBounds(bool change_work_area) {
TargetBounds target_bounds;
CalculateTargetBounds(state_, &target_bounds);
- UpdateBoundsAndOpacity(target_bounds, false, NULL);
+ UpdateBoundsAndOpacity(target_bounds, false, change_work_area, NULL);
// Update insets in ShelfWindowTargeter when shelf bounds change.
FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_,
WillChangeVisibilityState(visibility_state()));
}
+void ShelfLayoutManager::LayoutShelf() {
+ LayoutShelfAndUpdateBounds(true);
+}
+
ShelfVisibilityState ShelfLayoutManager::CalculateShelfVisibility() {
switch (shelf_widget_->shelf()->auto_hide_behavior()) {
case SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS:
@@ -549,9 +556,15 @@ void ShelfLayoutManager::OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) {
bool keyboard_is_about_to_hide = false;
if (new_bounds.IsEmpty() && !keyboard_bounds_.IsEmpty())
keyboard_is_about_to_hide = true;
+ // If new window behavior flag enabled and in non-sticky mode, do not change
+ // the work area.
+ bool change_work_area =
+ (!base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kAshUseNewVKWindowBehavior) ||
+ keyboard::KeyboardController::GetInstance()->get_lock_keyboard());
keyboard_bounds_ = new_bounds;
- OnWindowResized();
+ LayoutShelfAndUpdateBounds(change_work_area);
// On login screen if keyboard has been just hidden, update bounds just once
// but ignore target_bounds.work_area_insets since shelf overlaps with login
@@ -676,9 +689,9 @@ void ShelfLayoutManager::SetState(ShelfVisibilityState visibility_state) {
TargetBounds target_bounds;
CalculateTargetBounds(state_, &target_bounds);
- UpdateBoundsAndOpacity(target_bounds, true, delay_background_change
- ? update_shelf_observer_
- : NULL);
+ UpdateBoundsAndOpacity(target_bounds, true, true, delay_background_change
oshima 2016/08/03 21:22:38 nit: can you add the comment to bool value like t
hariank 2016/08/03 21:29:37 Done.
+ ? update_shelf_observer_
+ : NULL);
// The delegate must be notified after |state_| is updated so that it can
// query the new target bounds.
@@ -702,6 +715,7 @@ void ShelfLayoutManager::SetState(ShelfVisibilityState visibility_state) {
void ShelfLayoutManager::UpdateBoundsAndOpacity(
const TargetBounds& target_bounds,
bool animate,
+ bool change_work_area,
ui::ImplicitAnimationObserver* observer) {
base::AutoReset<bool> auto_reset_updating_bounds(&updating_bounds_, true);
{
@@ -763,7 +777,8 @@ void ShelfLayoutManager::UpdateBoundsAndOpacity(
// For crbug.com/622431, when the shelf alignment is BOTTOM_LOCKED, we
// don't set display work area, as it is not real user-set alignment.
if (!state_.is_screen_locked &&
- shelf_widget_->GetAlignment() != SHELF_ALIGNMENT_BOTTOM_LOCKED) {
+ shelf_widget_->GetAlignment() != SHELF_ALIGNMENT_BOTTOM_LOCKED &&
+ change_work_area) {
gfx::Insets insets;
// If user session is blocked (login to new user session or add user to
// the existing session - multi-profile) then give 100% of work area only
@@ -1165,7 +1180,7 @@ void ShelfLayoutManager::SessionStateChanged(
}
TargetBounds target_bounds;
CalculateTargetBounds(state_, &target_bounds);
- UpdateBoundsAndOpacity(target_bounds, true, NULL);
+ UpdateBoundsAndOpacity(target_bounds, true, true, NULL);
UpdateVisibilityState();
}

Powered by Google App Engine
This is Rietveld 408576698