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" | 7 #include "chrome/browser/browser.h" |
8 #include "chrome/browser/browser_list.h" | 8 #include "chrome/browser/browser_list.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/browser_window.h" | 10 #include "chrome/browser/browser_window.h" |
11 #include "chrome/browser/pref_service.h" | 11 #include "chrome/browser/prefs/pref_service.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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 // On non-Mac platforms, we are less aggressive about repositioning. Simply | 320 // On non-Mac platforms, we are less aggressive about repositioning. Simply |
321 // ensure that at least kMinVisibleWidth * kMinVisibleHeight is visible. | 321 // ensure that at least kMinVisibleWidth * kMinVisibleHeight is visible. |
322 const int min_y = work_area.y() + kMinVisibleHeight - bounds->height(); | 322 const int min_y = work_area.y() + kMinVisibleHeight - bounds->height(); |
323 const int min_x = work_area.x() + kMinVisibleWidth - bounds->width(); | 323 const int min_x = work_area.x() + kMinVisibleWidth - bounds->width(); |
324 const int max_y = work_area.bottom() - kMinVisibleHeight; | 324 const int max_y = work_area.bottom() - kMinVisibleHeight; |
325 const int max_x = work_area.right() - kMinVisibleWidth; | 325 const int max_x = work_area.right() - kMinVisibleWidth; |
326 bounds->set_y(std::max(min_y, std::min(max_y, bounds->y()))); | 326 bounds->set_y(std::max(min_y, std::min(max_y, bounds->y()))); |
327 bounds->set_x(std::max(min_x, std::min(max_x, bounds->x()))); | 327 bounds->set_x(std::max(min_x, std::min(max_x, bounds->x()))); |
328 #endif // defined(OS_MACOSX) | 328 #endif // defined(OS_MACOSX) |
329 } | 329 } |
OLD | NEW |