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

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

Issue 2787363002: Moves couple of WmShell methods to standalone functions (Closed)
Patch Set: feedback and fix applist Created 3 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
« no previous file with comments | « ash/common/wm/panels/panel_layout_manager.cc ('k') | ash/common/wm/window_positioner.cc » ('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_controller.h" 9 #include "ash/common/session/session_controller.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/public/cpp/shell_window_ids.h" 13 #include "ash/public/cpp/shell_window_ids.h"
14 #include "ash/shell.h" 14 #include "ash/shell.h"
15 #include "ash/wm/window_util.h"
15 #include "base/memory/ptr_util.h" 16 #include "base/memory/ptr_util.h"
16 #include "base/stl_util.h" 17 #include "base/stl_util.h"
17 #include "ui/aura/client/aura_constants.h" 18 #include "ui/aura/client/aura_constants.h"
18 #include "ui/aura/window.h" 19 #include "ui/aura/window.h"
19 #include "ui/keyboard/keyboard_controller.h" 20 #include "ui/keyboard/keyboard_controller.h"
20 21
21 namespace ash { 22 namespace ash {
22 namespace { 23 namespace {
23 24
24 // The center point of the window can diverge this much from the center point 25 // The center point of the window can diverge this much from the center point
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 window->GetParent()->GetLayoutManager()); 192 window->GetParent()->GetLayoutManager());
192 return layout_manager->window_dimmer_ && 193 return layout_manager->window_dimmer_ &&
193 WmWindow::Get(layout_manager->window_dimmer_->window()) == window; 194 WmWindow::Get(layout_manager->window_dimmer_->window()) == window;
194 } 195 }
195 196
196 //////////////////////////////////////////////////////////////////////////////// 197 ////////////////////////////////////////////////////////////////////////////////
197 // SystemModalContainerLayoutManager, private: 198 // SystemModalContainerLayoutManager, private:
198 199
199 void SystemModalContainerLayoutManager::AddModalWindow(WmWindow* window) { 200 void SystemModalContainerLayoutManager::AddModalWindow(WmWindow* window) {
200 if (modal_windows_.empty()) { 201 if (modal_windows_.empty()) {
201 WmWindow* capture_window = WmShell::Get()->GetCaptureWindow(); 202 WmWindow* capture_window = WmWindow::Get(wm::GetCaptureWindow());
202 if (capture_window) 203 if (capture_window)
203 capture_window->ReleaseCapture(); 204 capture_window->ReleaseCapture();
204 } 205 }
205 DCHECK(window->IsVisible()); 206 DCHECK(window->IsVisible());
206 DCHECK(!base::ContainsValue(modal_windows_, window)); 207 DCHECK(!base::ContainsValue(modal_windows_, window));
207 208
208 modal_windows_.push_back(window); 209 modal_windows_.push_back(window);
209 WmShell::Get()->CreateModalBackground(window); 210 WmShell::Get()->CreateModalBackground(window);
210 window->GetParent()->StackChildAtTop(window); 211 window->GetParent()->StackChildAtTop(window);
211 212
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 bool SystemModalContainerLayoutManager::IsBoundsCentered( 273 bool SystemModalContainerLayoutManager::IsBoundsCentered(
273 const gfx::Rect& bounds) const { 274 const gfx::Rect& bounds) const {
274 gfx::Point window_center = bounds.CenterPoint(); 275 gfx::Point window_center = bounds.CenterPoint();
275 gfx::Point container_center = GetUsableDialogArea().CenterPoint(); 276 gfx::Point container_center = GetUsableDialogArea().CenterPoint();
276 return std::abs(window_center.x() - container_center.x()) < 277 return std::abs(window_center.x() - container_center.x()) <
277 kCenterPixelDelta && 278 kCenterPixelDelta &&
278 std::abs(window_center.y() - container_center.y()) < kCenterPixelDelta; 279 std::abs(window_center.y() - container_center.y()) < kCenterPixelDelta;
279 } 280 }
280 281
281 } // namespace ash 282 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/wm/panels/panel_layout_manager.cc ('k') | ash/common/wm/window_positioner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698