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

Side by Side Diff: chrome/browser/ui/window_sizer/window_sizer_ash.cc

Issue 11030017: Add context to gfx::Screen calls in support of simultaneous desktop+ash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix other os's Created 8 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 | Annotate | Revision Log
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 "chrome/browser/ui/window_sizer/window_sizer.h" 5 #include "chrome/browser/ui/window_sizer/window_sizer.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/wm/window_cycle_controller.h" 8 #include "ash/wm/window_cycle_controller.h"
9 #include "ash/wm/window_util.h" 9 #include "ash/wm/window_util.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 140
141 gfx::Rect other_bounds_in_screen = top_window->GetBoundsInScreen(); 141 gfx::Rect other_bounds_in_screen = top_window->GetBoundsInScreen();
142 bool move_right = 142 bool move_right =
143 other_bounds_in_screen.CenterPoint().x() < work_area.CenterPoint().x(); 143 other_bounds_in_screen.CenterPoint().x() < work_area.CenterPoint().x();
144 144
145 // In case we have only one window, we move the other window fully to the 145 // In case we have only one window, we move the other window fully to the
146 // "other side" - making room for this new window. 146 // "other side" - making room for this new window.
147 if (count == 1) { 147 if (count == 1) {
148 gfx::Display display = 148 gfx::Display display =
149 gfx::Screen::GetDisplayMatching( 149 gfx::Screen::GetDisplayMatching(
150 gfx::Screen::BadTwoWorldsContext(),
150 top_window->GetRootWindow()->GetBoundsInScreen()); 151 top_window->GetRootWindow()->GetBoundsInScreen());
151 if (MoveRect(work_area, other_bounds_in_screen, !move_right)) 152 if (MoveRect(work_area, other_bounds_in_screen, !move_right))
152 top_window->SetBoundsInScreen(other_bounds_in_screen, display); 153 top_window->SetBoundsInScreen(other_bounds_in_screen, display);
153 } 154 }
154 // Use the size of the other window, and mirror the location to the 155 // Use the size of the other window, and mirror the location to the
155 // opposite side. Then make sure that it is inside our work area 156 // opposite side. Then make sure that it is inside our work area
156 // (if possible). 157 // (if possible).
157 *bounds_in_screen = other_bounds_in_screen; 158 *bounds_in_screen = other_bounds_in_screen;
158 MoveRect(work_area, *bounds_in_screen, move_right); 159 MoveRect(work_area, *bounds_in_screen, move_right);
159 if (bounds_in_screen->bottom() > work_area.bottom()) 160 if (bounds_in_screen->bottom() > work_area.bottom())
(...skipping 25 matching lines...) Expand all
185 if (default_width > kMaximumWindowWidth) { 186 if (default_width > kMaximumWindowWidth) {
186 // The window should get centered on the screen and not follow the grid. 187 // The window should get centered on the screen and not follow the grid.
187 offset_x = (work_area.width() - kMaximumWindowWidth) / 2; 188 offset_x = (work_area.width() - kMaximumWindowWidth) / 2;
188 default_width = kMaximumWindowWidth; 189 default_width = kMaximumWindowWidth;
189 } 190 }
190 default_bounds->SetRect(work_area.x() + offset_x, 191 default_bounds->SetRect(work_area.x() + offset_x,
191 work_area.y() + kDesktopBorderSize, 192 work_area.y() + kDesktopBorderSize,
192 default_width, 193 default_width,
193 default_height); 194 default_height);
194 } 195 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698