Chromium Code Reviews| Index: ash/shelf/shelf_layout_manager.cc |
| diff --git a/ash/shelf/shelf_layout_manager.cc b/ash/shelf/shelf_layout_manager.cc |
| index 93788749a62681cf0fe7bea47b9cbc29f3f9f978..a053469c669eae27a10731cbc50245113a187a6e 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" |
| @@ -267,7 +270,7 @@ gfx::Size ShelfLayoutManager::GetPreferredSize() { |
| void ShelfLayoutManager::LayoutShelf() { |
| TargetBounds target_bounds; |
| CalculateTargetBounds(state_, &target_bounds); |
| - UpdateBoundsAndOpacity(target_bounds, false, NULL); |
| + UpdateBoundsAndOpacity(target_bounds, false, true, NULL); |
| // Update insets in ShelfWindowTargeter when shelf bounds change. |
| FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, |
| @@ -550,8 +553,20 @@ void ShelfLayoutManager::OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) { |
| 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(); |
| + TargetBounds target_bounds; |
| + CalculateTargetBounds(state_, &target_bounds); |
| + UpdateBoundsAndOpacity(target_bounds, false, change_work_area, NULL); |
| + |
| + FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, |
| + WillChangeVisibilityState(visibility_state())); |
|
oshima
2016/08/02 16:33:53
Instead of coyping, can you add change_work_area p
hariank
2016/08/03 18:09:39
Done.
|
| // 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 |
| @@ -660,9 +675,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 |
| + ? update_shelf_observer_ |
| + : NULL); |
| // The delegate must be notified after |state_| is updated so that it can |
| // query the new target bounds. |
| @@ -686,6 +701,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); |
| { |
| @@ -747,7 +763,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 +1182,7 @@ void ShelfLayoutManager::SessionStateChanged( |
| } |
| TargetBounds target_bounds; |
| CalculateTargetBounds(state_, &target_bounds); |
| - UpdateBoundsAndOpacity(target_bounds, true, NULL); |
| + UpdateBoundsAndOpacity(target_bounds, true, true, NULL); |
| UpdateVisibilityState(); |
| } |