OLD | NEW |
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/shelf/shelf_layout_manager.h" | 5 #include "ash/shelf/shelf_layout_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "ash/animation/animation_change_type.h" | 11 #include "ash/animation/animation_change_type.h" |
12 #include "ash/keyboard/keyboard_observer_register.h" | 12 #include "ash/keyboard/keyboard_observer_register.h" |
13 #include "ash/public/cpp/shell_window_ids.h" | 13 #include "ash/public/cpp/shell_window_ids.h" |
14 #include "ash/root_window_controller.h" | 14 #include "ash/root_window_controller.h" |
15 #include "ash/screen_util.h" | 15 #include "ash/screen_util.h" |
16 #include "ash/session/session_controller.h" | 16 #include "ash/session/session_controller.h" |
17 #include "ash/shelf/shelf.h" | 17 #include "ash/shelf/shelf.h" |
18 #include "ash/shelf/shelf_constants.h" | 18 #include "ash/shelf/shelf_constants.h" |
19 #include "ash/shelf/shelf_layout_manager_observer.h" | 19 #include "ash/shelf/shelf_layout_manager_observer.h" |
20 #include "ash/shelf/shelf_widget.h" | 20 #include "ash/shelf/shelf_widget.h" |
21 #include "ash/shell.h" | 21 #include "ash/shell.h" |
22 #include "ash/shell_port.h" | 22 #include "ash/shell_port.h" |
23 #include "ash/system/status_area_widget.h" | 23 #include "ash/system/status_area_widget.h" |
24 #include "ash/wm/fullscreen_window_finder.h" | 24 #include "ash/wm/fullscreen_window_finder.h" |
25 #include "ash/wm/mru_window_tracker.h" | 25 #include "ash/wm/mru_window_tracker.h" |
26 #include "ash/wm/screen_pinning_controller.h" | 26 #include "ash/wm/screen_pinning_controller.h" |
27 #include "ash/wm/window_state.h" | 27 #include "ash/wm/window_state.h" |
28 #include "ash/wm_window.h" | |
29 #include "base/auto_reset.h" | 28 #include "base/auto_reset.h" |
30 #include "base/command_line.h" | 29 #include "base/command_line.h" |
31 #include "base/i18n/rtl.h" | 30 #include "base/i18n/rtl.h" |
32 #include "ui/base/ui_base_switches.h" | 31 #include "ui/base/ui_base_switches.h" |
33 #include "ui/compositor/layer.h" | 32 #include "ui/compositor/layer.h" |
34 #include "ui/compositor/layer_animation_observer.h" | 33 #include "ui/compositor/layer_animation_observer.h" |
35 #include "ui/compositor/layer_animator.h" | 34 #include "ui/compositor/layer_animator.h" |
36 #include "ui/compositor/scoped_layer_animation_settings.h" | 35 #include "ui/compositor/scoped_layer_animation_settings.h" |
37 #include "ui/display/display.h" | 36 #include "ui/display/display.h" |
38 #include "ui/display/screen.h" | 37 #include "ui/display/screen.h" |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 keyboard::KeyboardController::GetInstance()->keyboard_locked())); | 444 keyboard::KeyboardController::GetInstance()->keyboard_locked())); |
446 | 445 |
447 keyboard_bounds_ = new_bounds; | 446 keyboard_bounds_ = new_bounds; |
448 LayoutShelfAndUpdateBounds(change_work_area); | 447 LayoutShelfAndUpdateBounds(change_work_area); |
449 | 448 |
450 // On login screen if keyboard has been just hidden, update bounds just once | 449 // On login screen if keyboard has been just hidden, update bounds just once |
451 // but ignore target_bounds.work_area_insets since shelf overlaps with login | 450 // but ignore target_bounds.work_area_insets since shelf overlaps with login |
452 // window. | 451 // window. |
453 if (Shell::Get()->session_controller()->IsUserSessionBlocked() && | 452 if (Shell::Get()->session_controller()->IsUserSessionBlocked() && |
454 keyboard_is_about_to_hide) { | 453 keyboard_is_about_to_hide) { |
455 WmWindow* window = WmWindow::Get(shelf_widget_->GetNativeWindow()); | 454 ShellPort::Get()->SetDisplayWorkAreaInsets(shelf_widget_->GetNativeWindow(), |
456 ShellPort::Get()->SetDisplayWorkAreaInsets(window, gfx::Insets()); | 455 gfx::Insets()); |
457 } | 456 } |
458 } | 457 } |
459 | 458 |
460 void ShelfLayoutManager::OnKeyboardClosed() { | 459 void ShelfLayoutManager::OnKeyboardClosed() { |
461 keyboard_observer_.RemoveAll(); | 460 keyboard_observer_.RemoveAll(); |
462 } | 461 } |
463 | 462 |
464 ShelfBackgroundType ShelfLayoutManager::GetShelfBackgroundType() const { | 463 ShelfBackgroundType ShelfLayoutManager::GetShelfBackgroundType() const { |
465 if (state_.pre_lock_screen_animation_active) | 464 if (state_.pre_lock_screen_animation_active) |
466 return SHELF_BACKGROUND_DEFAULT; | 465 return SHELF_BACKGROUND_DEFAULT; |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 // don't set display work area, as it is not real user-set alignment. | 634 // don't set display work area, as it is not real user-set alignment. |
636 if (!state_.IsScreenLocked() && | 635 if (!state_.IsScreenLocked() && |
637 shelf_->alignment() != SHELF_ALIGNMENT_BOTTOM_LOCKED && | 636 shelf_->alignment() != SHELF_ALIGNMENT_BOTTOM_LOCKED && |
638 change_work_area) { | 637 change_work_area) { |
639 gfx::Insets insets; | 638 gfx::Insets insets; |
640 // If user session is blocked (login to new user session or add user to | 639 // If user session is blocked (login to new user session or add user to |
641 // the existing session - multi-profile) then give 100% of work area only | 640 // the existing session - multi-profile) then give 100% of work area only |
642 // if keyboard is not shown. | 641 // if keyboard is not shown. |
643 if (!state_.IsAddingSecondaryUser() || !keyboard_bounds_.IsEmpty()) | 642 if (!state_.IsAddingSecondaryUser() || !keyboard_bounds_.IsEmpty()) |
644 insets = target_bounds.work_area_insets; | 643 insets = target_bounds.work_area_insets; |
645 WmWindow* shelf_window = WmWindow::Get(shelf_widget_->GetNativeWindow()); | 644 ShellPort::Get()->SetDisplayWorkAreaInsets( |
646 ShellPort::Get()->SetDisplayWorkAreaInsets(shelf_window, insets); | 645 shelf_widget_->GetNativeWindow(), insets); |
647 } | 646 } |
648 } | 647 } |
649 | 648 |
650 // Set an empty border to avoid the shelf view and status area overlapping. | 649 // Set an empty border to avoid the shelf view and status area overlapping. |
651 // TODO(msw): Avoid setting bounds of views within the shelf widget here. | 650 // TODO(msw): Avoid setting bounds of views within the shelf widget here. |
652 gfx::Rect shelf_bounds = gfx::Rect(target_bounds.shelf_bounds_in_root.size()); | 651 gfx::Rect shelf_bounds = gfx::Rect(target_bounds.shelf_bounds_in_root.size()); |
653 shelf_widget_->GetContentsView()->SetBorder(views::CreateEmptyBorder( | 652 shelf_widget_->GetContentsView()->SetBorder(views::CreateEmptyBorder( |
654 shelf_bounds.InsetsFrom(target_bounds.shelf_bounds_in_shelf))); | 653 shelf_bounds.InsetsFrom(target_bounds.shelf_bounds_in_shelf))); |
655 shelf_widget_->GetContentsView()->Layout(); | 654 shelf_widget_->GetContentsView()->Layout(); |
656 | 655 |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1155 gesture_drag_status_ = GESTURE_DRAG_NONE; | 1154 gesture_drag_status_ = GESTURE_DRAG_NONE; |
1156 } | 1155 } |
1157 | 1156 |
1158 void ShelfLayoutManager::CancelGestureDrag() { | 1157 void ShelfLayoutManager::CancelGestureDrag() { |
1159 gesture_drag_status_ = GESTURE_DRAG_CANCEL_IN_PROGRESS; | 1158 gesture_drag_status_ = GESTURE_DRAG_CANCEL_IN_PROGRESS; |
1160 UpdateVisibilityState(); | 1159 UpdateVisibilityState(); |
1161 gesture_drag_status_ = GESTURE_DRAG_NONE; | 1160 gesture_drag_status_ = GESTURE_DRAG_NONE; |
1162 } | 1161 } |
1163 | 1162 |
1164 } // namespace ash | 1163 } // namespace ash |
OLD | NEW |