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

Side by Side Diff: ash/wm/dock/docked_window_layout_manager.cc

Issue 1890713002: Adds WmWindow and converts WindowState to use it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge 2 trunk Created 4 years, 8 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) 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/wm/dock/docked_window_layout_manager.h" 5 #include "ash/wm/dock/docked_window_layout_manager.h"
6 6
7 #include "ash/screen_util.h" 7 #include "ash/screen_util.h"
8 #include "ash/shelf/shelf.h" 8 #include "ash/shelf/shelf.h"
9 #include "ash/shelf/shelf_constants.h" 9 #include "ash/shelf/shelf_constants.h"
10 #include "ash/shelf/shelf_layout_manager.h" 10 #include "ash/shelf/shelf_layout_manager.h"
11 #include "ash/shelf/shelf_types.h" 11 #include "ash/shelf/shelf_types.h"
12 #include "ash/shelf/shelf_widget.h" 12 #include "ash/shelf/shelf_widget.h"
13 #include "ash/shell.h" 13 #include "ash/shell.h"
14 #include "ash/shell_window_ids.h" 14 #include "ash/shell_window_ids.h"
15 #include "ash/wm/coordinate_conversion.h" 15 #include "ash/wm/coordinate_conversion.h"
16 #include "ash/wm/window_animations.h" 16 #include "ash/wm/window_animations.h"
17 #include "ash/wm/window_properties.h" 17 #include "ash/wm/window_properties.h"
18 #include "ash/wm/window_resizer.h" 18 #include "ash/wm/window_resizer.h"
19 #include "ash/wm/window_state.h" 19 #include "ash/wm/window_state.h"
20 #include "ash/wm/window_state_aura.h"
20 #include "ash/wm/window_util.h" 21 #include "ash/wm/window_util.h"
21 #include "ash/wm/workspace_controller.h" 22 #include "ash/wm/workspace_controller.h"
22 #include "base/auto_reset.h" 23 #include "base/auto_reset.h"
23 #include "base/command_line.h" 24 #include "base/command_line.h"
24 #include "base/metrics/histogram.h" 25 #include "base/metrics/histogram.h"
25 #include "grit/ash_resources.h" 26 #include "grit/ash_resources.h"
26 #include "third_party/skia/include/core/SkColor.h" 27 #include "third_party/skia/include/core/SkColor.h"
27 #include "third_party/skia/include/core/SkPaint.h" 28 #include "third_party/skia/include/core/SkPaint.h"
28 #include "ui/aura/client/focus_client.h" 29 #include "ui/aura/client/focus_client.h"
29 #include "ui/aura/client/window_tree_client.h" 30 #include "ui/aura/client/window_tree_client.h"
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 BackgroundAnimatorChangeType change_type) { 828 BackgroundAnimatorChangeType change_type) {
828 background_widget_->SetBackgroundType(background_type, change_type); 829 background_widget_->SetBackgroundType(background_type, change_type);
829 } 830 }
830 831
831 ///////////////////////////////////////////////////////////////////////////// 832 /////////////////////////////////////////////////////////////////////////////
832 // DockedWindowLayoutManager, WindowStateObserver implementation: 833 // DockedWindowLayoutManager, WindowStateObserver implementation:
833 834
834 void DockedWindowLayoutManager::OnPreWindowStateTypeChange( 835 void DockedWindowLayoutManager::OnPreWindowStateTypeChange(
835 wm::WindowState* window_state, 836 wm::WindowState* window_state,
836 wm::WindowStateType old_type) { 837 wm::WindowStateType old_type) {
837 aura::Window* window = window_state->window(); 838 aura::Window* window = window_state->aura_window();
838 if (IsPopupOrTransient(window)) 839 if (IsPopupOrTransient(window))
839 return; 840 return;
840 // The window property will still be set, but no actual change will occur 841 // The window property will still be set, but no actual change will occur
841 // until OnFullscreenStateChange is called when exiting fullscreen. 842 // until OnFullscreenStateChange is called when exiting fullscreen.
842 if (in_fullscreen_) 843 if (in_fullscreen_)
843 return; 844 return;
844 if (!window_state->IsDocked()) { 845 if (!window_state->IsDocked()) {
845 if (window != dragged_window_) { 846 if (window != dragged_window_) {
846 UndockWindow(window); 847 UndockWindow(window);
847 if (window_state->IsMaximizedOrFullscreen()) 848 if (window_state->IsMaximizedOrFullscreen())
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 settings.SetTransitionDuration( 953 settings.SetTransitionDuration(
953 base::TimeDelta::FromMilliseconds(kMinimizeDurationMs)); 954 base::TimeDelta::FromMilliseconds(kMinimizeDurationMs));
954 settings.LockTransitionDuration(); 955 settings.LockTransitionDuration();
955 wm::GetWindowState(window)->Minimize(); 956 wm::GetWindowState(window)->Minimize();
956 } 957 }
957 } 958 }
958 } 959 }
959 960
960 void DockedWindowLayoutManager::MinimizeDockedWindow( 961 void DockedWindowLayoutManager::MinimizeDockedWindow(
961 wm::WindowState* window_state) { 962 wm::WindowState* window_state) {
962 DCHECK(!IsPopupOrTransient(window_state->window())); 963 DCHECK(!IsPopupOrTransient(window_state->aura_window()));
963 window_state->window()->Hide(); 964 window_state->window()->Hide();
964 if (window_state->IsActive()) 965 if (window_state->IsActive())
965 window_state->Deactivate(); 966 window_state->Deactivate();
966 RecordUmaAction(DOCKED_ACTION_MINIMIZE, event_source_); 967 RecordUmaAction(DOCKED_ACTION_MINIMIZE, event_source_);
967 } 968 }
968 969
969 void DockedWindowLayoutManager::RestoreDockedWindow( 970 void DockedWindowLayoutManager::RestoreDockedWindow(
970 wm::WindowState* window_state) { 971 wm::WindowState* window_state) {
971 aura::Window* window = window_state->window(); 972 aura::Window* window = window_state->aura_window();
972 DCHECK(!IsPopupOrTransient(window)); 973 DCHECK(!IsPopupOrTransient(window));
973 // Always place restored window at the bottom shuffling the other windows up. 974 // Always place restored window at the bottom shuffling the other windows up.
974 // TODO(varkha): add a separate container for docked windows to keep track 975 // TODO(varkha): add a separate container for docked windows to keep track
975 // of ordering. 976 // of ordering.
976 gfx::Display display = 977 gfx::Display display =
977 gfx::Screen::GetScreen()->GetDisplayNearestWindow(dock_container_); 978 gfx::Screen::GetScreen()->GetDisplayNearestWindow(dock_container_);
978 const gfx::Rect work_area = display.work_area(); 979 const gfx::Rect work_area = display.work_area();
979 980
980 // Evict the window if it can no longer be docked because of its height. 981 // Evict the window if it can no longer be docked because of its height.
981 if (!CanDockWindow(window, DOCKED_ALIGNMENT_NONE)) { 982 if (!CanDockWindow(window, DOCKED_ALIGNMENT_NONE)) {
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
1359 1360
1360 void DockedWindowLayoutManager::OnKeyboardBoundsChanging( 1361 void DockedWindowLayoutManager::OnKeyboardBoundsChanging(
1361 const gfx::Rect& keyboard_bounds) { 1362 const gfx::Rect& keyboard_bounds) {
1362 // This bounds change will have caused a change to the Shelf which does not 1363 // This bounds change will have caused a change to the Shelf which does not
1363 // propagate automatically to this class, so manually recalculate bounds. 1364 // propagate automatically to this class, so manually recalculate bounds.
1364 Relayout(); 1365 Relayout();
1365 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING); 1366 UpdateDockBounds(DockedWindowLayoutManagerObserver::KEYBOARD_BOUNDS_CHANGING);
1366 } 1367 }
1367 1368
1368 } // namespace ash 1369 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698