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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 112 |
113 // Only save main window information to preferences. | 113 // Only save main window information to preferences. |
114 PrefService* prefs = browser_->profile()->GetPrefs(); | 114 PrefService* prefs = browser_->profile()->GetPrefs(); |
115 if (!prefs || browser_ != chrome::GetLastActiveBrowser()) | 115 if (!prefs || browser_ != chrome::GetLastActiveBrowser()) |
116 return; | 116 return; |
117 | 117 |
118 // Save the current work area, in flipped coordinates. | 118 // Save the current work area, in flipped coordinates. |
119 gfx::Rect workArea(NSRectToCGRect([windowScreen visibleFrame])); | 119 gfx::Rect workArea(NSRectToCGRect([windowScreen visibleFrame])); |
120 workArea.set_y(monitorFrame.size.height - workArea.y() - workArea.height()); | 120 workArea.set_y(monitorFrame.size.height - workArea.y() - workArea.height()); |
121 | 121 |
122 DictionaryPrefUpdate update( | 122 scoped_ptr<DictionaryPrefUpdate> update = |
123 prefs, | 123 chrome::GetWindowPlacementDictionaryReadWrite( |
124 chrome::GetWindowPlacementKey(browser_.get()).c_str()); | 124 chrome::GetWindowName(browser_.get()), |
125 base::DictionaryValue* windowPreferences = update.Get(); | 125 browser_->profile()->GetPrefs()); |
| 126 base::DictionaryValue* windowPreferences = update->Get(); |
126 windowPreferences->SetInteger("left", bounds.x()); | 127 windowPreferences->SetInteger("left", bounds.x()); |
127 windowPreferences->SetInteger("top", bounds.y()); | 128 windowPreferences->SetInteger("top", bounds.y()); |
128 windowPreferences->SetInteger("right", bounds.right()); | 129 windowPreferences->SetInteger("right", bounds.right()); |
129 windowPreferences->SetInteger("bottom", bounds.bottom()); | 130 windowPreferences->SetInteger("bottom", bounds.bottom()); |
130 windowPreferences->SetBoolean("maximized", false); | 131 windowPreferences->SetBoolean("maximized", false); |
131 windowPreferences->SetBoolean("always_on_top", false); | 132 windowPreferences->SetBoolean("always_on_top", false); |
132 windowPreferences->SetInteger("work_area_left", workArea.x()); | 133 windowPreferences->SetInteger("work_area_left", workArea.x()); |
133 windowPreferences->SetInteger("work_area_top", workArea.y()); | 134 windowPreferences->SetInteger("work_area_top", workArea.y()); |
134 windowPreferences->SetInteger("work_area_right", workArea.right()); | 135 windowPreferences->SetInteger("work_area_right", workArea.right()); |
135 windowPreferences->SetInteger("work_area_bottom", workArea.bottom()); | 136 windowPreferences->SetInteger("work_area_bottom", workArea.bottom()); |
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1145 | 1146 |
1146 - (void)exitAppKitFullscreen { | 1147 - (void)exitAppKitFullscreen { |
1147 DCHECK(base::mac::IsOSLionOrLater()); | 1148 DCHECK(base::mac::IsOSLionOrLater()); |
1148 if (FramedBrowserWindow* framedBrowserWindow = | 1149 if (FramedBrowserWindow* framedBrowserWindow = |
1149 base::mac::ObjCCast<FramedBrowserWindow>([self window])) { | 1150 base::mac::ObjCCast<FramedBrowserWindow>([self window])) { |
1150 [framedBrowserWindow toggleSystemFullScreen]; | 1151 [framedBrowserWindow toggleSystemFullScreen]; |
1151 } | 1152 } |
1152 } | 1153 } |
1153 | 1154 |
1154 @end // @implementation BrowserWindowController(Private) | 1155 @end // @implementation BrowserWindowController(Private) |
OLD | NEW |