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 #import "chrome/browser/ui/cocoa/browser_window_controller_private.h" | 5 #import "chrome/browser/ui/cocoa/browser_window_controller_private.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 119 |
120 // Only save main window information to preferences. | 120 // Only save main window information to preferences. |
121 PrefService* prefs = browser_->profile()->GetPrefs(); | 121 PrefService* prefs = browser_->profile()->GetPrefs(); |
122 if (!prefs || browser_ != chrome::GetLastActiveBrowser()) | 122 if (!prefs || browser_ != chrome::GetLastActiveBrowser()) |
123 return; | 123 return; |
124 | 124 |
125 // Save the current work area, in flipped coordinates. | 125 // Save the current work area, in flipped coordinates. |
126 gfx::Rect workArea(NSRectToCGRect([windowScreen visibleFrame])); | 126 gfx::Rect workArea(NSRectToCGRect([windowScreen visibleFrame])); |
127 workArea.set_y(monitorFrame.size.height - workArea.y() - workArea.height()); | 127 workArea.set_y(monitorFrame.size.height - workArea.y() - workArea.height()); |
128 | 128 |
129 DictionaryPrefUpdate update( | 129 scoped_ptr<DictionaryPrefUpdate> update = |
130 prefs, | 130 chrome::GetWindowPlacementDictionaryReadWrite( |
131 chrome::GetWindowPlacementKey(browser_.get()).c_str()); | 131 chrome::GetWindowName(browser_.get()), |
132 base::DictionaryValue* windowPreferences = update.Get(); | 132 browser_->profile()->GetPrefs()); |
| 133 base::DictionaryValue* windowPreferences = update->Get(); |
133 windowPreferences->SetInteger("left", bounds.x()); | 134 windowPreferences->SetInteger("left", bounds.x()); |
134 windowPreferences->SetInteger("top", bounds.y()); | 135 windowPreferences->SetInteger("top", bounds.y()); |
135 windowPreferences->SetInteger("right", bounds.right()); | 136 windowPreferences->SetInteger("right", bounds.right()); |
136 windowPreferences->SetInteger("bottom", bounds.bottom()); | 137 windowPreferences->SetInteger("bottom", bounds.bottom()); |
137 windowPreferences->SetBoolean("maximized", false); | 138 windowPreferences->SetBoolean("maximized", false); |
138 windowPreferences->SetBoolean("always_on_top", false); | 139 windowPreferences->SetBoolean("always_on_top", false); |
139 windowPreferences->SetInteger("work_area_left", workArea.x()); | 140 windowPreferences->SetInteger("work_area_left", workArea.x()); |
140 windowPreferences->SetInteger("work_area_top", workArea.y()); | 141 windowPreferences->SetInteger("work_area_top", workArea.y()); |
141 windowPreferences->SetInteger("work_area_right", workArea.right()); | 142 windowPreferences->SetInteger("work_area_right", workArea.right()); |
142 windowPreferences->SetInteger("work_area_bottom", workArea.bottom()); | 143 windowPreferences->SetInteger("work_area_bottom", workArea.bottom()); |
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1071 NSMakePoint(0, NSHeight([infoBarContainerController_ view].frame) - | 1072 NSMakePoint(0, NSHeight([infoBarContainerController_ view].frame) - |
1072 overlappingTipHeight); | 1073 overlappingTipHeight); |
1073 infoBarTop = [[infoBarContainerController_ view] convertPoint:infoBarTop | 1074 infoBarTop = [[infoBarContainerController_ view] convertPoint:infoBarTop |
1074 toView:nil]; | 1075 toView:nil]; |
1075 | 1076 |
1076 topArrowHeight = iconBottom.y - infoBarTop.y; | 1077 topArrowHeight = iconBottom.y - infoBarTop.y; |
1077 return topArrowHeight; | 1078 return topArrowHeight; |
1078 } | 1079 } |
1079 | 1080 |
1080 @end // @implementation BrowserWindowController(Private) | 1081 @end // @implementation BrowserWindowController(Private) |
OLD | NEW |