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

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

Issue 10910164: Removes the grid from ash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix ShelfBrowserTest Created 8 years, 3 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 95
96 return false; 96 return false;
97 } 97 }
98 98
99 void WindowSizer::GetDefaultWindowBoundsAsh(gfx::Rect* default_bounds) const { 99 void WindowSizer::GetDefaultWindowBoundsAsh(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_->GetPrimaryDisplayWorkArea(); 103 gfx::Rect work_area = monitor_info_provider_->GetPrimaryDisplayWorkArea();
104 104
105 DCHECK_EQ(kDesktopBorderSize, ash::Shell::GetInstance()->GetGridSize());
106
107 // There should be a 'desktop' border around the window at the left and right 105 // There should be a 'desktop' border around the window at the left and right
108 // side. 106 // side.
109 int default_width = work_area.width() - 2 * kDesktopBorderSize; 107 int default_width = work_area.width() - 2 * kDesktopBorderSize;
110 // There should also be a 'desktop' border around the window at the top. 108 // 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. 109 // Since the workspace excludes the tray area we only need one border size.
112 int default_height = work_area.height() - kDesktopBorderSize; 110 int default_height = work_area.height() - kDesktopBorderSize;
113 // We align the size to the grid size to avoid any surprise when the 111 // 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. 112 // monitor height isn't divide-able by our alignment factor.
115 default_width -= default_width % kDesktopBorderSize; 113 default_width -= default_width % kDesktopBorderSize;
116 default_height -= default_height % kDesktopBorderSize; 114 default_height -= default_height % kDesktopBorderSize;
117 int offset_x = kDesktopBorderSize; 115 int offset_x = kDesktopBorderSize;
118 if (default_width > kMaximumWindowWidth) { 116 if (default_width > kMaximumWindowWidth) {
119 // The window should get centered on the screen and not follow the grid. 117 // The window should get centered on the screen and not follow the grid.
120 offset_x = (work_area.width() - kMaximumWindowWidth) / 2; 118 offset_x = (work_area.width() - kMaximumWindowWidth) / 2;
121 default_width = kMaximumWindowWidth; 119 default_width = kMaximumWindowWidth;
122 } 120 }
123 default_bounds->SetRect(work_area.x() + offset_x, 121 default_bounds->SetRect(work_area.x() + offset_x,
124 work_area.y() + kDesktopBorderSize, 122 work_area.y() + kDesktopBorderSize,
125 default_width, 123 default_width,
126 default_height); 124 default_height);
127 } 125 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/window_sizer/window_sizer.cc ('k') | chrome/browser/ui/window_sizer/window_sizer_ash_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698