| 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.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" |
| 11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
| 13 #include "chrome/browser/ui/browser_list.h" | 13 #include "chrome/browser/ui/browser_list.h" |
| 14 #include "chrome/browser/ui/browser_window.h" | 14 #include "chrome/browser/ui/browser_window.h" |
| 15 #include "ui/aura/window.h" | 15 #include "ui/aura/window.h" |
| 16 #include "ui/aura/window_delegate.h" | 16 #include "ui/aura/window_delegate.h" |
| 17 #include "ui/gfx/screen.h" | 17 #include "ui/gfx/screen.h" |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 // Check if the window was not created as popup or as panel. | 21 // Check if the window was not created as popup or as panel. |
| 22 bool IsValidToplevelWindow(aura::Window* window) { | 22 bool IsValidToplevelWindow(aura::Window* window) { |
| 23 for (BrowserList::const_iterator iter = BrowserList::begin(); | 23 for (BrowserList::const_iterator iter = BrowserList::begin(); |
| 24 iter != BrowserList::end(); | 24 iter != BrowserList::end(); |
| 25 ++iter) { | 25 ++iter) { |
| 26 Browser* browser = *iter; | 26 Browser* browser = *iter; |
| 27 if (browser && browser->window() && | 27 if (browser && browser->window() && |
| 28 browser->window()->GetNativeHandle() == window) { | 28 browser->window()->GetNativeWindow() == window) { |
| 29 return (!(browser->is_type_popup() || browser->is_type_panel())); | 29 return (!(browser->is_type_popup() || browser->is_type_panel())); |
| 30 } | 30 } |
| 31 } | 31 } |
| 32 // A window which has no browser associated with it is probably not a window | 32 // A window which has no browser associated with it is probably not a window |
| 33 // of which we want to copy the size from. | 33 // of which we want to copy the size from. |
| 34 return false; | 34 return false; |
| 35 } | 35 } |
| 36 | 36 |
| 37 // Get the first open window in the stack on the screen. | 37 // Get the first open window in the stack on the screen. |
| 38 aura::Window* GetTopWindow() { | 38 aura::Window* GetTopWindow() { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } |
| OLD | NEW |