OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/window_sizer.h" | 5 #include "chrome/browser/window_sizer.h" |
6 | 6 |
7 #include "chrome/browser/browser.h" | |
8 #include "chrome/browser/browser_list.h" | 7 #include "chrome/browser/browser_list.h" |
9 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/browser_window.h" | 9 #include "chrome/browser/browser_window.h" |
11 #include "chrome/browser/prefs/pref_service.h" | 10 #include "chrome/browser/prefs/pref_service.h" |
| 11 #include "chrome/browser/ui/browser.h" |
12 #include "chrome/common/pref_names.h" | 12 #include "chrome/common/pref_names.h" |
13 | 13 |
14 /////////////////////////////////////////////////////////////////////////////// | 14 /////////////////////////////////////////////////////////////////////////////// |
15 // An implementation of WindowSizer::StateProvider that gets the last active | 15 // An implementation of WindowSizer::StateProvider that gets the last active |
16 // and persistent state from the browser window and the user's profile. | 16 // and persistent state from the browser window and the user's profile. |
17 class DefaultStateProvider : public WindowSizer::StateProvider { | 17 class DefaultStateProvider : public WindowSizer::StateProvider { |
18 public: | 18 public: |
19 explicit DefaultStateProvider(const std::string& app_name, Browser* browser) | 19 explicit DefaultStateProvider(const std::string& app_name, Browser* browser) |
20 : app_name_(app_name), | 20 : app_name_(app_name), |
21 browser_(browser) { | 21 browser_(browser) { |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 // On non-Mac platforms, we are less aggressive about repositioning. Simply | 327 // On non-Mac platforms, we are less aggressive about repositioning. Simply |
328 // ensure that at least kMinVisibleWidth * kMinVisibleHeight is visible. | 328 // ensure that at least kMinVisibleWidth * kMinVisibleHeight is visible. |
329 const int min_y = work_area.y() + kMinVisibleHeight - bounds->height(); | 329 const int min_y = work_area.y() + kMinVisibleHeight - bounds->height(); |
330 const int min_x = work_area.x() + kMinVisibleWidth - bounds->width(); | 330 const int min_x = work_area.x() + kMinVisibleWidth - bounds->width(); |
331 const int max_y = work_area.bottom() - kMinVisibleHeight; | 331 const int max_y = work_area.bottom() - kMinVisibleHeight; |
332 const int max_x = work_area.right() - kMinVisibleWidth; | 332 const int max_x = work_area.right() - kMinVisibleWidth; |
333 bounds->set_y(std::max(min_y, std::min(max_y, bounds->y()))); | 333 bounds->set_y(std::max(min_y, std::min(max_y, bounds->y()))); |
334 bounds->set_x(std::max(min_x, std::min(max_x, bounds->x()))); | 334 bounds->set_x(std::max(min_x, std::min(max_x, bounds->x()))); |
335 #endif // defined(OS_MACOSX) | 335 #endif // defined(OS_MACOSX) |
336 } | 336 } |
OLD | NEW |