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

Side by Side Diff: ash/wm/system_modal_container_layout_manager.cc

Issue 2095193002: clang-format all of //ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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) 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/system_modal_container_layout_manager.h" 5 #include "ash/wm/system_modal_container_layout_manager.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "ash/common/session/session_state_delegate.h" 9 #include "ash/common/session/session_state_delegate.h"
10 #include "ash/common/shell_window_ids.h" 10 #include "ash/common/shell_window_ids.h"
(...skipping 22 matching lines...) Expand all
33 33
34 //////////////////////////////////////////////////////////////////////////////// 34 ////////////////////////////////////////////////////////////////////////////////
35 // SystemModalContainerLayoutManager, public: 35 // SystemModalContainerLayoutManager, public:
36 36
37 SystemModalContainerLayoutManager::SystemModalContainerLayoutManager( 37 SystemModalContainerLayoutManager::SystemModalContainerLayoutManager(
38 aura::Window* container) 38 aura::Window* container)
39 : SnapToPixelLayoutManager(container), 39 : SnapToPixelLayoutManager(container),
40 container_(container), 40 container_(container),
41 modal_background_(nullptr) {} 41 modal_background_(nullptr) {}
42 42
43 SystemModalContainerLayoutManager::~SystemModalContainerLayoutManager() { 43 SystemModalContainerLayoutManager::~SystemModalContainerLayoutManager() {}
44 }
45 44
46 //////////////////////////////////////////////////////////////////////////////// 45 ////////////////////////////////////////////////////////////////////////////////
47 // SystemModalContainerLayoutManager, aura::LayoutManager implementation: 46 // SystemModalContainerLayoutManager, aura::LayoutManager implementation:
48 47
49 void SystemModalContainerLayoutManager::OnWindowResized() { 48 void SystemModalContainerLayoutManager::OnWindowResized() {
50 PositionDialogsAfterWorkAreaResize(); 49 PositionDialogsAfterWorkAreaResize();
51 } 50 }
52 51
53 void SystemModalContainerLayoutManager::OnWindowAddedToLayout( 52 void SystemModalContainerLayoutManager::OnWindowAddedToLayout(
54 aura::Window* child) { 53 aura::Window* child) {
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 gfx::Rect SystemModalContainerLayoutManager::GetUsableDialogArea() { 207 gfx::Rect SystemModalContainerLayoutManager::GetUsableDialogArea() {
209 // Instead of resizing the system modal container, we move only the modal 208 // Instead of resizing the system modal container, we move only the modal
210 // windows. This way we avoid flashing lines upon resize animation and if the 209 // windows. This way we avoid flashing lines upon resize animation and if the
211 // keyboard will not fill left to right, the background is still covered. 210 // keyboard will not fill left to right, the background is still covered.
212 gfx::Rect valid_bounds = container_->bounds(); 211 gfx::Rect valid_bounds = container_->bounds();
213 keyboard::KeyboardController* keyboard_controller = 212 keyboard::KeyboardController* keyboard_controller =
214 keyboard::KeyboardController::GetInstance(); 213 keyboard::KeyboardController::GetInstance();
215 if (keyboard_controller) { 214 if (keyboard_controller) {
216 gfx::Rect bounds = keyboard_controller->current_keyboard_bounds(); 215 gfx::Rect bounds = keyboard_controller->current_keyboard_bounds();
217 if (!bounds.IsEmpty()) { 216 if (!bounds.IsEmpty()) {
218 valid_bounds.set_height(std::max( 217 valid_bounds.set_height(
219 0, valid_bounds.height() - bounds.height())); 218 std::max(0, valid_bounds.height() - bounds.height()));
220 } 219 }
221 } 220 }
222 return valid_bounds; 221 return valid_bounds;
223 } 222 }
224 223
225 gfx::Rect SystemModalContainerLayoutManager::GetCenteredAndOrFittedBounds( 224 gfx::Rect SystemModalContainerLayoutManager::GetCenteredAndOrFittedBounds(
226 const aura::Window* window) { 225 const aura::Window* window) {
227 gfx::Rect target_bounds; 226 gfx::Rect target_bounds;
228 gfx::Rect usable_area = GetUsableDialogArea(); 227 gfx::Rect usable_area = GetUsableDialogArea();
229 if (window->GetProperty(kCenteredKey)) { 228 if (window->GetProperty(kCenteredKey)) {
(...skipping 11 matching lines...) Expand all
241 // TODO(skuhne): M37 should add over scroll functionality to address this. 240 // TODO(skuhne): M37 should add over scroll functionality to address this.
242 target_bounds.set_size(window->bounds().size()); 241 target_bounds.set_size(window->bounds().size());
243 } 242 }
244 return target_bounds; 243 return target_bounds;
245 } 244 }
246 245
247 bool SystemModalContainerLayoutManager::DialogIsCentered( 246 bool SystemModalContainerLayoutManager::DialogIsCentered(
248 const gfx::Rect& window_bounds) { 247 const gfx::Rect& window_bounds) {
249 gfx::Point window_center = window_bounds.CenterPoint(); 248 gfx::Point window_center = window_bounds.CenterPoint();
250 gfx::Point container_center = GetUsableDialogArea().CenterPoint(); 249 gfx::Point container_center = GetUsableDialogArea().CenterPoint();
251 return 250 return std::abs(window_center.x() - container_center.x()) <
252 std::abs(window_center.x() - container_center.x()) < kCenterPixelDelta && 251 kCenterPixelDelta &&
253 std::abs(window_center.y() - container_center.y()) < kCenterPixelDelta; 252 std::abs(window_center.y() - container_center.y()) < kCenterPixelDelta;
254 } 253 }
255 254
256 } // namespace ash 255 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/system_modal_container_event_filter.cc ('k') | ash/wm/system_modal_container_layout_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698