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

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

Issue 2426473009: mash: Place views Wi-Fi network config dialogs in correct window parent (Closed)
Patch Set: review comments Created 4 years, 2 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/options/network_config_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 } 67 }
68 } 68 }
69 69
70 void SystemModalContainerLayoutManager::OnWindowResized() { 70 void SystemModalContainerLayoutManager::OnWindowResized() {
71 PositionDialogsAfterWorkAreaResize(); 71 PositionDialogsAfterWorkAreaResize();
72 } 72 }
73 73
74 void SystemModalContainerLayoutManager::OnWindowAddedToLayout(WmWindow* child) { 74 void SystemModalContainerLayoutManager::OnWindowAddedToLayout(WmWindow* child) {
75 DCHECK(child->GetType() == ui::wm::WINDOW_TYPE_NORMAL || 75 DCHECK(child->GetType() == ui::wm::WINDOW_TYPE_NORMAL ||
76 child->GetType() == ui::wm::WINDOW_TYPE_POPUP); 76 child->GetType() == ui::wm::WINDOW_TYPE_POPUP);
77 DCHECK(container_->GetShellWindowId() != 77 // TODO(mash): IsUserSessionBlocked() depends on knowing the login state. We
78 kShellWindowId_LockSystemModalContainer || 78 // need a non-stub version of SessionStateDelegate. crbug.com/648964
79 WmShell::Get()->GetSessionStateDelegate()->IsUserSessionBlocked()); 79 if (!WmShell::Get()->IsRunningInMash()) {
80 DCHECK(container_->GetShellWindowId() !=
81 kShellWindowId_LockSystemModalContainer ||
82 WmShell::Get()->GetSessionStateDelegate()->IsUserSessionBlocked());
83 }
80 // Since this is for SystemModal, there is no good reason to add windows 84 // Since this is for SystemModal, there is no good reason to add windows
81 // other than MODAL_TYPE_NONE or MODAL_TYPE_SYSTEM. DCHECK to avoid simple 85 // other than MODAL_TYPE_NONE or MODAL_TYPE_SYSTEM. DCHECK to avoid simple
82 // mistake. 86 // mistake.
83 DCHECK_NE(GetModalType(child), ui::MODAL_TYPE_CHILD); 87 DCHECK_NE(GetModalType(child), ui::MODAL_TYPE_CHILD);
84 DCHECK_NE(GetModalType(child), ui::MODAL_TYPE_WINDOW); 88 DCHECK_NE(GetModalType(child), ui::MODAL_TYPE_WINDOW);
85 89
86 child->AddObserver(this); 90 child->AddObserver(this);
87 if (GetModalType(child) == ui::MODAL_TYPE_SYSTEM && child->IsVisible()) 91 if (GetModalType(child) == ui::MODAL_TYPE_SYSTEM && child->IsVisible())
88 AddModalWindow(child); 92 AddModalWindow(child);
89 } 93 }
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 bool SystemModalContainerLayoutManager::IsBoundsCentered( 268 bool SystemModalContainerLayoutManager::IsBoundsCentered(
265 const gfx::Rect& bounds) const { 269 const gfx::Rect& bounds) const {
266 gfx::Point window_center = bounds.CenterPoint(); 270 gfx::Point window_center = bounds.CenterPoint();
267 gfx::Point container_center = GetUsableDialogArea().CenterPoint(); 271 gfx::Point container_center = GetUsableDialogArea().CenterPoint();
268 return std::abs(window_center.x() - container_center.x()) < 272 return std::abs(window_center.x() - container_center.x()) <
269 kCenterPixelDelta && 273 kCenterPixelDelta &&
270 std::abs(window_center.y() - container_center.y()) < kCenterPixelDelta; 274 std::abs(window_center.y() - container_center.y()) < kCenterPixelDelta;
271 } 275 }
272 276
273 } // namespace ash 277 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/options/network_config_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698