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

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

Issue 2731663002: Remove WmWindowProperty (Closed)
Patch Set: rebase Created 3 years, 9 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/common/wm/system_modal_container_layout_manager.h" 5 #include "ash/common/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/wm/window_dimmer.h" 10 #include "ash/common/wm/window_dimmer.h"
11 #include "ash/common/wm_shell.h" 11 #include "ash/common/wm_shell.h"
12 #include "ash/common/wm_window.h" 12 #include "ash/common/wm_window.h"
13 #include "ash/common/wm_window_property.h"
14 #include "ash/public/cpp/shell_window_ids.h" 13 #include "ash/public/cpp/shell_window_ids.h"
15 #include "base/memory/ptr_util.h" 14 #include "base/memory/ptr_util.h"
16 #include "base/stl_util.h" 15 #include "base/stl_util.h"
17 #include "ui/aura/client/aura_constants.h" 16 #include "ui/aura/client/aura_constants.h"
18 #include "ui/aura/window.h" 17 #include "ui/aura/window.h"
19 #include "ui/keyboard/keyboard_controller.h" 18 #include "ui/keyboard/keyboard_controller.h"
20 19
21 namespace ash { 20 namespace ash {
22 namespace { 21 namespace {
23 22
24 // The center point of the window can diverge this much from the center point 23 // The center point of the window can diverge this much from the center point
25 // of the container to be kept centered upon resizing operations. 24 // of the container to be kept centered upon resizing operations.
26 const int kCenterPixelDelta = 32; 25 const int kCenterPixelDelta = 32;
27 26
28 ui::ModalType GetModalType(WmWindow* window) { 27 ui::ModalType GetModalType(WmWindow* window) {
29 return static_cast<ui::ModalType>( 28 return static_cast<ui::ModalType>(
30 window->GetIntProperty(WmWindowProperty::MODAL_TYPE)); 29 window->aura_window()->GetProperty(aura::client::kModalKey));
31 } 30 }
32 31
33 bool HasTransientAncestor(const WmWindow* window, const WmWindow* ancestor) { 32 bool HasTransientAncestor(const WmWindow* window, const WmWindow* ancestor) {
34 const WmWindow* transient_parent = window->GetTransientParent(); 33 const WmWindow* transient_parent = window->GetTransientParent();
35 if (transient_parent == ancestor) 34 if (transient_parent == ancestor)
36 return true; 35 return true;
37 return transient_parent ? HasTransientAncestor(transient_parent, ancestor) 36 return transient_parent ? HasTransientAncestor(transient_parent, ancestor)
38 : false; 37 : false;
39 } 38 }
40 } 39 }
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 bool SystemModalContainerLayoutManager::IsBoundsCentered( 271 bool SystemModalContainerLayoutManager::IsBoundsCentered(
273 const gfx::Rect& bounds) const { 272 const gfx::Rect& bounds) const {
274 gfx::Point window_center = bounds.CenterPoint(); 273 gfx::Point window_center = bounds.CenterPoint();
275 gfx::Point container_center = GetUsableDialogArea().CenterPoint(); 274 gfx::Point container_center = GetUsableDialogArea().CenterPoint();
276 return std::abs(window_center.x() - container_center.x()) < 275 return std::abs(window_center.x() - container_center.x()) <
277 kCenterPixelDelta && 276 kCenterPixelDelta &&
278 std::abs(window_center.y() - container_center.y()) < kCenterPixelDelta; 277 std::abs(window_center.y() - container_center.y()) < kCenterPixelDelta;
279 } 278 }
280 279
281 } // namespace ash 280 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/wm/panels/panel_window_resizer.cc ('k') | ash/common/wm/wm_snap_to_pixel_layout_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698