| 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_common_unittest.h" | 5 #include "chrome/browser/ui/window_sizer/window_sizer_common_unittest.h" |
| 6 | 6 |
| 7 #include "ash/wm/window_resizer.h" | 7 #include "ash/wm/window_resizer.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 return work_areas_[GetMonitorIndexMatchingBounds(match_rect)]; | 37 return work_areas_[GetMonitorIndexMatchingBounds(match_rect)]; |
| 38 } | 38 } |
| 39 | 39 |
| 40 size_t TestMonitorInfoProvider::GetMonitorIndexMatchingBounds( | 40 size_t TestMonitorInfoProvider::GetMonitorIndexMatchingBounds( |
| 41 const gfx::Rect& match_rect) const { | 41 const gfx::Rect& match_rect) const { |
| 42 int max_area = 0; | 42 int max_area = 0; |
| 43 size_t max_area_index = 0; | 43 size_t max_area_index = 0; |
| 44 // Loop through all the monitors, finding the one that intersects the | 44 // Loop through all the monitors, finding the one that intersects the |
| 45 // largest area of the supplied match rect. | 45 // largest area of the supplied match rect. |
| 46 for (size_t i = 0; i < work_areas_.size(); ++i) { | 46 for (size_t i = 0; i < work_areas_.size(); ++i) { |
| 47 gfx::Rect overlap(match_rect.Intersect(work_areas_[i])); | 47 gfx::Rect overlap = work_areas_[i]; |
| 48 overlap.Intersect(match_rect); |
| 48 int area = overlap.width() * overlap.height(); | 49 int area = overlap.width() * overlap.height(); |
| 49 if (area > max_area) { | 50 if (area > max_area) { |
| 50 max_area = area; | 51 max_area = area; |
| 51 max_area_index = i; | 52 max_area_index = i; |
| 52 } | 53 } |
| 53 } | 54 } |
| 54 return max_area_index; | 55 return max_area_index; |
| 55 } | 56 } |
| 56 | 57 |
| 57 TestStateProvider::TestStateProvider(): | 58 TestStateProvider::TestStateProvider(): |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 { // Check that a window which hangs out of the screen get moved back in. | 379 { // Check that a window which hangs out of the screen get moved back in. |
| 379 gfx::Rect window_bounds; | 380 gfx::Rect window_bounds; |
| 380 GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(), gfx::Rect(), | 381 GetWindowBounds(tentwentyfour, tentwentyfour, gfx::Rect(), gfx::Rect(), |
| 381 gfx::Rect(), DEFAULT, NULL, | 382 gfx::Rect(), DEFAULT, NULL, |
| 382 gfx::Rect(1020, 700, 100, 100), &window_bounds); | 383 gfx::Rect(1020, 700, 100, 100), &window_bounds); |
| 383 EXPECT_EQ("924,668 100x100", window_bounds.ToString()); | 384 EXPECT_EQ("924,668 100x100", window_bounds.ToString()); |
| 384 } | 385 } |
| 385 } | 386 } |
| 386 | 387 |
| 387 #endif // defined(OS_MACOSX) | 388 #endif // defined(OS_MACOSX) |
| OLD | NEW |