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 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1179 | 1180 |
1180 - (void)exitAppKitFullscreen { | 1181 - (void)exitAppKitFullscreen { |
1181 DCHECK(base::mac::IsOSLionOrLater()); | 1182 DCHECK(base::mac::IsOSLionOrLater()); |
1182 if (FramedBrowserWindow* framedBrowserWindow = | 1183 if (FramedBrowserWindow* framedBrowserWindow = |
1183 base::mac::ObjCCast<FramedBrowserWindow>([self window])) { | 1184 base::mac::ObjCCast<FramedBrowserWindow>([self window])) { |
1184 [framedBrowserWindow toggleSystemFullScreen]; | 1185 [framedBrowserWindow toggleSystemFullScreen]; |
1185 } | 1186 } |
1186 } | 1187 } |
1187 | 1188 |
1188 @end // @implementation BrowserWindowController(Private) | 1189 @end // @implementation BrowserWindowController(Private) |
OLD | NEW |