| OLD | NEW |
| 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 11 matching lines...) Expand all Loading... |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 // When a window gets opened in default mode and the screen is less then this | 24 // When a window gets opened in default mode and the screen is less then this |
| 25 // width, the window will get opened in maximized mode. | 25 // width, the window will get opened in maximized mode. |
| 26 const int kForceMaximizeWidthLimit = 640; | 26 const int kForceMaximizeWidthLimit = 640; |
| 27 | 27 |
| 28 // Check if the given browser is 'valid': It is a tabbed, non minimized | 28 // Check if the given browser is 'valid': It is a tabbed, non minimized |
| 29 // window, which intersects with the |bounds_in_screen| area of a given screen. | 29 // window, which intersects with the |bounds_in_screen| area of a given screen. |
| 30 bool IsValidBrowser(Browser* browser, const gfx::Rect& bounds_in_screen) { | 30 bool IsValidBrowser(Browser* browser, const gfx::Rect& bounds_in_screen) { |
| 31 return (browser && browser->window() && | 31 return (browser && browser->window() && |
| 32 !(browser->is_type_popup() || browser->is_type_panel()) && | 32 !browser->is_type_popup() && |
| 33 !browser->window()->IsMinimized() && | 33 !browser->window()->IsMinimized() && |
| 34 browser->window()->GetNativeWindow() && | 34 browser->window()->GetNativeWindow() && |
| 35 bounds_in_screen.Intersects( | 35 bounds_in_screen.Intersects( |
| 36 browser->window()->GetNativeWindow()->GetBoundsInScreen())); | 36 browser->window()->GetNativeWindow()->GetBoundsInScreen())); |
| 37 } | 37 } |
| 38 | 38 |
| 39 // Check if the window was not created as popup or as panel, it is | 39 // Check if the window was not created as popup or as panel, it is |
| 40 // on the screen defined by |bounds_in_screen| and visible. | 40 // on the screen defined by |bounds_in_screen| and visible. |
| 41 bool IsValidToplevelWindow(aura::Window* window, | 41 bool IsValidToplevelWindow(aura::Window* window, |
| 42 const gfx::Rect& bounds_in_screen) { | 42 const gfx::Rect& bounds_in_screen) { |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 if (default_width > kMaximumWindowWidth) { | 227 if (default_width > kMaximumWindowWidth) { |
| 228 // The window should get centered on the screen and not follow the grid. | 228 // The window should get centered on the screen and not follow the grid. |
| 229 offset_x = (work_area.width() - kMaximumWindowWidth) / 2; | 229 offset_x = (work_area.width() - kMaximumWindowWidth) / 2; |
| 230 default_width = kMaximumWindowWidth; | 230 default_width = kMaximumWindowWidth; |
| 231 } | 231 } |
| 232 default_bounds->SetRect(work_area.x() + offset_x, | 232 default_bounds->SetRect(work_area.x() + offset_x, |
| 233 work_area.y() + kDesktopBorderSize, | 233 work_area.y() + kDesktopBorderSize, |
| 234 default_width, | 234 default_width, |
| 235 default_height); | 235 default_height); |
| 236 } | 236 } |
| OLD | NEW |