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

Side by Side Diff: chrome/browser/ui/window_sizer_win.cc

Issue 10704022: browser: Move window sizer to subdir. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/window_sizer_unittest.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/window_sizer.h"
6
7 #include "chrome/browser/ui/browser.h"
8 #include "chrome/browser/ui/browser_list.h"
9 #include "chrome/browser/ui/browser_window.h"
10
11 // How much horizontal and vertical offset there is between newly
12 // opened windows.
13 const int WindowSizer::kWindowTilePixels = 10;
14
15 // static
16 gfx::Point WindowSizer::GetDefaultPopupOrigin(const gfx::Size& size) {
17 RECT area;
18 SystemParametersInfo(SPI_GETWORKAREA, 0, &area, 0);
19 gfx::Point corner(area.left, area.top);
20
21 if (Browser* b = BrowserList::GetLastActive()) {
22 RECT browser;
23 HWND window = reinterpret_cast<HWND>(b->window()->GetNativeWindow());
24 if (GetWindowRect(window, &browser)) {
25 // Limit to not overflow the work area right and bottom edges.
26 gfx::Point limit(
27 std::min(browser.left + kWindowTilePixels, area.right-size.width()),
28 std::min(browser.top + kWindowTilePixels, area.bottom-size.height())
29 );
30 // Adjust corner to now overflow the work area left and top edges, so
31 // that if a popup does not fit the title-bar is remains visible.
32 corner = gfx::Point(
33 std::max(corner.x(), limit.x()),
34 std::max(corner.y(), limit.y())
35 );
36 }
37 }
38 return corner;
39 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/window_sizer_unittest.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698