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 #import "chrome/browser/cocoa/browser_window_controller_private.h" | 5 #import "chrome/browser/cocoa/browser_window_controller_private.h" |
6 | 6 |
7 #include "base/mac_util.h" | 7 #include "base/mac_util.h" |
8 #import "base/scoped_nsobject.h" | 8 #import "base/scoped_nsobject.h" |
9 #include "chrome/browser/browser.h" | 9 #include "chrome/browser/browser.h" |
10 #include "chrome/browser/browser_list.h" | 10 #include "chrome/browser/browser_list.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 72 |
73 // Start with the window's frame, which is in virtual coordinates. | 73 // Start with the window's frame, which is in virtual coordinates. |
74 // Do some y twiddling to flip the coordinate system. | 74 // Do some y twiddling to flip the coordinate system. |
75 gfx::Rect bounds(NSRectToCGRect([window frame])); | 75 gfx::Rect bounds(NSRectToCGRect([window frame])); |
76 bounds.set_y(monitorFrame.size.height - bounds.y() - bounds.height()); | 76 bounds.set_y(monitorFrame.size.height - bounds.y() - bounds.height()); |
77 | 77 |
78 // We also need to save the current work area, in flipped coordinates. | 78 // We also need to save the current work area, in flipped coordinates. |
79 gfx::Rect workArea(NSRectToCGRect([windowScreen visibleFrame])); | 79 gfx::Rect workArea(NSRectToCGRect([windowScreen visibleFrame])); |
80 workArea.set_y(monitorFrame.size.height - workArea.y() - workArea.height()); | 80 workArea.set_y(monitorFrame.size.height - workArea.y() - workArea.height()); |
81 | 81 |
| 82 // Browser::SaveWindowPlacement is used for session restore. |
| 83 if (browser_->ShouldSaveWindowPlacement()) |
| 84 browser_->SaveWindowPlacement(bounds, /*maximized=*/ false); |
| 85 |
82 DictionaryValue* windowPreferences = prefs->GetMutableDictionary( | 86 DictionaryValue* windowPreferences = prefs->GetMutableDictionary( |
83 browser_->GetWindowPlacementKey().c_str()); | 87 browser_->GetWindowPlacementKey().c_str()); |
84 windowPreferences->SetInteger(L"left", bounds.x()); | 88 windowPreferences->SetInteger(L"left", bounds.x()); |
85 windowPreferences->SetInteger(L"top", bounds.y()); | 89 windowPreferences->SetInteger(L"top", bounds.y()); |
86 windowPreferences->SetInteger(L"right", bounds.right()); | 90 windowPreferences->SetInteger(L"right", bounds.right()); |
87 windowPreferences->SetInteger(L"bottom", bounds.bottom()); | 91 windowPreferences->SetInteger(L"bottom", bounds.bottom()); |
88 windowPreferences->SetBoolean(L"maximized", false); | 92 windowPreferences->SetBoolean(L"maximized", false); |
89 windowPreferences->SetBoolean(L"always_on_top", false); | 93 windowPreferences->SetBoolean(L"always_on_top", false); |
90 windowPreferences->SetInteger(L"work_area_left", workArea.x()); | 94 windowPreferences->SetInteger(L"work_area_left", workArea.x()); |
91 windowPreferences->SetInteger(L"work_area_top", workArea.y()); | 95 windowPreferences->SetInteger(L"work_area_top", workArea.y()); |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 - (void)disableBarVisibilityUpdates { | 463 - (void)disableBarVisibilityUpdates { |
460 // Early escape if there's nothing to do. | 464 // Early escape if there's nothing to do. |
461 if (!barVisibilityUpdatesEnabled_) | 465 if (!barVisibilityUpdatesEnabled_) |
462 return; | 466 return; |
463 | 467 |
464 barVisibilityUpdatesEnabled_ = NO; | 468 barVisibilityUpdatesEnabled_ = NO; |
465 [fullscreenController_ cancelAnimationAndTimers]; | 469 [fullscreenController_ cancelAnimationAndTimers]; |
466 } | 470 } |
467 | 471 |
468 @end // @implementation BrowserWindowController(Private) | 472 @end // @implementation BrowserWindowController(Private) |
OLD | NEW |