| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/dock/docked_window_layout_manager.h" | 5 #include "ash/common/wm/dock/docked_window_layout_manager.h" |
| 6 | 6 |
| 7 #include "ash/animation/animation_change_type.h" | 7 #include "ash/animation/animation_change_type.h" |
| 8 #include "ash/common/shelf/shelf_background_animator.h" | 8 #include "ash/common/shelf/shelf_background_animator.h" |
| 9 #include "ash/common/shelf/shelf_background_animator_observer.h" | 9 #include "ash/common/shelf/shelf_background_animator_observer.h" |
| 10 #include "ash/common/shelf/shelf_constants.h" | 10 #include "ash/common/shelf/shelf_constants.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "ash/shell.h" | 23 #include "ash/shell.h" |
| 24 #include "ash/wm/window_state_aura.h" | 24 #include "ash/wm/window_state_aura.h" |
| 25 #include "base/auto_reset.h" | 25 #include "base/auto_reset.h" |
| 26 #include "base/metrics/histogram_macros.h" | 26 #include "base/metrics/histogram_macros.h" |
| 27 #include "third_party/skia/include/core/SkColor.h" | 27 #include "third_party/skia/include/core/SkColor.h" |
| 28 #include "ui/aura/window.h" | 28 #include "ui/aura/window.h" |
| 29 #include "ui/base/resource/resource_bundle.h" | 29 #include "ui/base/resource/resource_bundle.h" |
| 30 #include "ui/compositor/scoped_layer_animation_settings.h" | 30 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 31 #include "ui/display/display.h" | 31 #include "ui/display/display.h" |
| 32 #include "ui/display/screen.h" | 32 #include "ui/display/screen.h" |
| 33 #include "ui/keyboard/keyboard_controller.h" |
| 33 #include "ui/views/background.h" | 34 #include "ui/views/background.h" |
| 34 #include "ui/wm/core/coordinate_conversion.h" | 35 #include "ui/wm/core/coordinate_conversion.h" |
| 35 #include "ui/wm/core/window_animations.h" | 36 #include "ui/wm/core/window_animations.h" |
| 36 #include "ui/wm/public/activation_client.h" | 37 #include "ui/wm/public/activation_client.h" |
| 37 | 38 |
| 38 namespace ash { | 39 namespace ash { |
| 39 | 40 |
| 40 // Minimum, maximum width of the dock area and a width of the gap | 41 // Minimum, maximum width of the dock area and a width of the gap |
| 41 // static | 42 // static |
| 42 const int DockedWindowLayoutManager::kMaxDockWidth = 360; | 43 const int DockedWindowLayoutManager::kMaxDockWidth = 360; |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 shelf_(nullptr), | 375 shelf_(nullptr), |
| 375 in_fullscreen_(root_window_controller_->GetWorkspaceWindowState() == | 376 in_fullscreen_(root_window_controller_->GetWorkspaceWindowState() == |
| 376 wm::WORKSPACE_WINDOW_STATE_FULL_SCREEN), | 377 wm::WORKSPACE_WINDOW_STATE_FULL_SCREEN), |
| 377 docked_width_(0), | 378 docked_width_(0), |
| 378 in_overview_(false), | 379 in_overview_(false), |
| 379 alignment_(DOCKED_ALIGNMENT_NONE), | 380 alignment_(DOCKED_ALIGNMENT_NONE), |
| 380 preferred_alignment_(DOCKED_ALIGNMENT_NONE), | 381 preferred_alignment_(DOCKED_ALIGNMENT_NONE), |
| 381 event_source_(DOCKED_ACTION_SOURCE_UNKNOWN), | 382 event_source_(DOCKED_ACTION_SOURCE_UNKNOWN), |
| 382 last_active_window_(nullptr), | 383 last_active_window_(nullptr), |
| 383 last_action_time_(base::Time::Now()), | 384 last_action_time_(base::Time::Now()), |
| 384 background_widget_(nullptr) { | 385 background_widget_(nullptr), |
| 386 keyboard_observer_(this) { |
| 385 DCHECK(dock_container); | 387 DCHECK(dock_container); |
| 386 Shell::GetInstance()->AddShellObserver(this); | 388 Shell::GetInstance()->AddShellObserver(this); |
| 387 Shell::GetInstance()->activation_client()->AddObserver(this); | 389 Shell::GetInstance()->activation_client()->AddObserver(this); |
| 388 display::Screen::GetScreen()->AddObserver(this); | 390 display::Screen::GetScreen()->AddObserver(this); |
| 389 } | 391 } |
| 390 | 392 |
| 391 DockedWindowLayoutManager::~DockedWindowLayoutManager() { | 393 DockedWindowLayoutManager::~DockedWindowLayoutManager() { |
| 392 Shutdown(); | 394 Shutdown(); |
| 393 } | 395 } |
| 394 | 396 |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 void DockedWindowLayoutManager::OnOverviewModeStarting() { | 890 void DockedWindowLayoutManager::OnOverviewModeStarting() { |
| 889 in_overview_ = true; | 891 in_overview_ = true; |
| 890 UpdateDockBounds(DockedWindowLayoutManagerObserver::CHILD_CHANGED); | 892 UpdateDockBounds(DockedWindowLayoutManagerObserver::CHILD_CHANGED); |
| 891 } | 893 } |
| 892 | 894 |
| 893 void DockedWindowLayoutManager::OnOverviewModeEnded() { | 895 void DockedWindowLayoutManager::OnOverviewModeEnded() { |
| 894 in_overview_ = false; | 896 in_overview_ = false; |
| 895 UpdateDockBounds(DockedWindowLayoutManagerObserver::CHILD_CHANGED); | 897 UpdateDockBounds(DockedWindowLayoutManagerObserver::CHILD_CHANGED); |
| 896 } | 898 } |
| 897 | 899 |
| 900 void DockedWindowLayoutManager::OnVirtualKeyboardStateChanged( |
| 901 bool activated, |
| 902 WmWindow* root_window) { |
| 903 if (root_window != dock_container_->GetRootWindow()) |
| 904 return; |
| 905 |
| 906 keyboard::KeyboardController* const keyboard_controller = |
| 907 keyboard::KeyboardController::GetInstance(); |
| 908 if (activated && !keyboard_observer_.IsObserving(keyboard_controller)) { |
| 909 keyboard_observer_.Add(keyboard_controller); |
| 910 } else if (!activated && |
| 911 keyboard_observer_.IsObserving(keyboard_controller)) { |
| 912 keyboard_observer_.Remove(keyboard_controller); |
| 913 } |
| 914 } |
| 915 |
| 898 //////////////////////////////////////////////////////////////////////////////// | 916 //////////////////////////////////////////////////////////////////////////////// |
| 899 // DockedWindowLayoutManager private implementation: | 917 // DockedWindowLayoutManager private implementation: |
| 900 | 918 |
| 901 void DockedWindowLayoutManager::MaybeMinimizeChildrenExcept(WmWindow* child) { | 919 void DockedWindowLayoutManager::MaybeMinimizeChildrenExcept(WmWindow* child) { |
| 902 WindowSelectorController* window_selector_controller = | 920 WindowSelectorController* window_selector_controller = |
| 903 WmShell::Get()->window_selector_controller(); | 921 WmShell::Get()->window_selector_controller(); |
| 904 if (window_selector_controller->IsRestoringMinimizedWindows()) | 922 if (window_selector_controller->IsRestoringMinimizedWindows()) |
| 905 return; | 923 return; |
| 906 // Minimize any windows that don't fit without overlap. | 924 // Minimize any windows that don't fit without overlap. |
| 907 const gfx::Rect work_area = | 925 const gfx::Rect work_area = |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1330 // keyboard::KeyboardControllerObserver implementation: | 1348 // keyboard::KeyboardControllerObserver implementation: |
| 1331 | 1349 |
| 1332 void DockedWindowLayoutManager::OnKeyboardBoundsChanging( | 1350 void DockedWindowLayoutManager::OnKeyboardBoundsChanging( |
| 1333 const gfx::Rect& keyboard_bounds) { | 1351 const gfx::Rect& keyboard_bounds) { |
| 1334 // This bounds change will have caused a change to the Shelf which does not | 1352 // This bounds change will have caused a change to the Shelf which does not |
| 1335 // propagate automatically to this class, so manually recalculate bounds. | 1353 // propagate automatically to this class, so manually recalculate bounds. |
| 1336 Relayout(); | 1354 Relayout(); |
| 1337 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); | 1355 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); |
| 1338 } | 1356 } |
| 1339 | 1357 |
| 1340 void DockedWindowLayoutManager::OnKeyboardClosed() {} | 1358 void DockedWindowLayoutManager::OnKeyboardClosed() { |
| 1359 keyboard_observer_.RemoveAll(); |
| 1360 } |
| 1341 | 1361 |
| 1342 } // namespace ash | 1362 } // namespace ash |
| OLD | NEW |