Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Side by Side Diff: chrome/browser/ui/cocoa/browser_window_controller_private.mm

Issue 511393003: No longer register app window placement preference keys on the fly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move to own file and start unit tests Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 1139
1139 - (void)exitAppKitFullscreen { 1140 - (void)exitAppKitFullscreen {
1140 DCHECK(base::mac::IsOSLionOrLater()); 1141 DCHECK(base::mac::IsOSLionOrLater());
1141 if (FramedBrowserWindow* framedBrowserWindow = 1142 if (FramedBrowserWindow* framedBrowserWindow =
1142 base::mac::ObjCCast<FramedBrowserWindow>([self window])) { 1143 base::mac::ObjCCast<FramedBrowserWindow>([self window])) {
1143 [framedBrowserWindow toggleSystemFullScreen]; 1144 [framedBrowserWindow toggleSystemFullScreen];
1144 } 1145 }
1145 } 1146 }
1146 1147
1147 @end // @implementation BrowserWindowController(Private) 1148 @end // @implementation BrowserWindowController(Private)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698