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/wm/workspace/workspace_layout_manager.h" | 5 #include "ash/wm/workspace/workspace_layout_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ash/display/display_controller.h" | 9 #include "ash/display/display_controller.h" |
10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 window->GetTargetBounds()); | 155 window->GetTargetBounds()); |
156 int vertical_displacement = | 156 int vertical_displacement = |
157 std::max(0, window_bounds.bottom() - new_bounds.y()); | 157 std::max(0, window_bounds.bottom() - new_bounds.y()); |
158 int shift = std::min(vertical_displacement, | 158 int shift = std::min(vertical_displacement, |
159 window_bounds.y() - work_area_in_parent_.y()); | 159 window_bounds.y() - work_area_in_parent_.y()); |
160 if (shift > 0) { | 160 if (shift > 0) { |
161 gfx::Point origin(window_bounds.x(), window_bounds.y() - shift); | 161 gfx::Point origin(window_bounds.x(), window_bounds.y() - shift); |
162 SetChildBounds(window, gfx::Rect(origin, window_bounds.size())); | 162 SetChildBounds(window, gfx::Rect(origin, window_bounds.size())); |
163 } | 163 } |
164 } else if (window_state->HasRestoreBounds()) { | 164 } else if (window_state->HasRestoreBounds()) { |
165 // Keyboard hidden, restore original bounds if they exist. | 165 // Keyboard hidden, restore original bounds if they exist. If the user has |
| 166 // resized or dragged the window in the meantime, WorkspaceWindowResizer |
| 167 // will have cleared the restore bounds and this code will not accidentally |
| 168 // override user intent. |
166 window_state->SetAndClearRestoreBounds(); | 169 window_state->SetAndClearRestoreBounds(); |
167 } | 170 } |
168 } | 171 } |
169 | 172 |
170 ////////////////////////////////////////////////////////////////////////////// | 173 ////////////////////////////////////////////////////////////////////////////// |
171 // WorkspaceLayoutManager, ash::ShellObserver implementation: | 174 // WorkspaceLayoutManager, ash::ShellObserver implementation: |
172 | 175 |
173 void WorkspaceLayoutManager::OnDisplayWorkAreaInsetsChanged() { | 176 void WorkspaceLayoutManager::OnDisplayWorkAreaInsetsChanged() { |
174 const gfx::Rect work_area(ScreenUtil::ConvertRectFromScreen( | 177 const gfx::Rect work_area(ScreenUtil::ConvertRectFromScreen( |
175 window_, | 178 window_, |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 bool is_fullscreen = GetRootWindowController( | 322 bool is_fullscreen = GetRootWindowController( |
320 window_->GetRootWindow())->GetWindowForFullscreenMode() != NULL; | 323 window_->GetRootWindow())->GetWindowForFullscreenMode() != NULL; |
321 if (is_fullscreen != is_fullscreen_) { | 324 if (is_fullscreen != is_fullscreen_) { |
322 ash::Shell::GetInstance()->NotifyFullscreenStateChange( | 325 ash::Shell::GetInstance()->NotifyFullscreenStateChange( |
323 is_fullscreen, window_->GetRootWindow()); | 326 is_fullscreen, window_->GetRootWindow()); |
324 is_fullscreen_ = is_fullscreen; | 327 is_fullscreen_ = is_fullscreen; |
325 } | 328 } |
326 } | 329 } |
327 | 330 |
328 } // namespace ash | 331 } // namespace ash |
OLD | NEW |