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

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

Issue 10540123: Rename gfx::Screen::GetMonitorXXXX to gfx::Screen::GetDisplayXXX. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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.cc ('k') | chrome/browser/ui/window_sizer_common_unittest.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 "chrome/browser/ui/window_sizer.h" 5 #include "chrome/browser/ui/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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // If both fail we will continue the default path. 93 // If both fail we will continue the default path.
94 } 94 }
95 95
96 return false; 96 return false;
97 } 97 }
98 98
99 void WindowSizer::GetDefaultWindowBounds(gfx::Rect* default_bounds) const { 99 void WindowSizer::GetDefaultWindowBounds(gfx::Rect* default_bounds) const {
100 DCHECK(default_bounds); 100 DCHECK(default_bounds);
101 DCHECK(monitor_info_provider_.get()); 101 DCHECK(monitor_info_provider_.get());
102 102
103 gfx::Rect work_area = monitor_info_provider_->GetPrimaryMonitorWorkArea(); 103 gfx::Rect work_area = monitor_info_provider_->GetPrimaryDisplayWorkArea();
104 104
105 DCHECK_EQ(kDesktopBorderSize, ash::Shell::GetInstance()->GetGridSize()); 105 DCHECK_EQ(kDesktopBorderSize, ash::Shell::GetInstance()->GetGridSize());
106 106
107 // There should be a 'desktop' border around the window at the left and right 107 // There should be a 'desktop' border around the window at the left and right
108 // side. 108 // side.
109 int default_width = work_area.width() - 2 * kDesktopBorderSize; 109 int default_width = work_area.width() - 2 * kDesktopBorderSize;
110 // There should also be a 'desktop' border around the window at the top. 110 // There should also be a 'desktop' border around the window at the top.
111 // Since the workspace excludes the tray area we only need one border size. 111 // Since the workspace excludes the tray area we only need one border size.
112 int default_height = work_area.height() - kDesktopBorderSize; 112 int default_height = work_area.height() - kDesktopBorderSize;
113 // We align the size to the grid size to avoid any surprise when the 113 // We align the size to the grid size to avoid any surprise when the
114 // monitor height isn't divide-able by our alignment factor. 114 // monitor height isn't divide-able by our alignment factor.
115 default_width -= default_width % kDesktopBorderSize; 115 default_width -= default_width % kDesktopBorderSize;
116 default_height -= default_height % kDesktopBorderSize; 116 default_height -= default_height % kDesktopBorderSize;
117 int offset_x = kDesktopBorderSize; 117 int offset_x = kDesktopBorderSize;
118 int maximum_window_width = 1280; 118 int maximum_window_width = 1280;
119 if (default_width > maximum_window_width) { 119 if (default_width > maximum_window_width) {
120 // The window should get centered on the screen and not follow the grid. 120 // The window should get centered on the screen and not follow the grid.
121 offset_x = (work_area.width() - maximum_window_width) / 2; 121 offset_x = (work_area.width() - maximum_window_width) / 2;
122 // Never make a window wider then 1280. 122 // Never make a window wider then 1280.
123 default_width = maximum_window_width; 123 default_width = maximum_window_width;
124 } 124 }
125 default_bounds->SetRect(work_area.x() + offset_x, 125 default_bounds->SetRect(work_area.x() + offset_x,
126 work_area.y() + kDesktopBorderSize, 126 work_area.y() + kDesktopBorderSize,
127 default_width, 127 default_width,
128 default_height); 128 default_height);
129 } 129 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/window_sizer.cc ('k') | chrome/browser/ui/window_sizer_common_unittest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698