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

Unified Diff: chrome/browser/cocoa/nswindow_local_state.mm

Issue 536086: Mac: Save/restore task manager window pos and size. (Closed)
Patch Set: comments Created 10 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/cocoa/nswindow_local_state.mm
diff --git a/chrome/browser/cocoa/nswindow_local_state.mm b/chrome/browser/cocoa/nswindow_local_state.mm
deleted file mode 100644
index 42bc9486a2b4fb0dafd7756618716e8937635232..0000000000000000000000000000000000000000
--- a/chrome/browser/cocoa/nswindow_local_state.mm
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#import <Cocoa/Cocoa.h>
-#include "chrome/common/pref_service.h"
-
-@implementation NSWindow (LocalStateAdditions)
-
-- (void)saveWindowPositionToPrefs:(PrefService*)prefs
- withPath:(const wchar_t*)path {
- DCHECK(prefs);
- // Save the origin of the window.
- DictionaryValue* windowPrefs = prefs->GetMutableDictionary(path);
- NSRect frame = [self frame];
- windowPrefs->SetInteger(L"x", frame.origin.x);
- windowPrefs->SetInteger(L"y", frame.origin.y);
-}
-
-- (void)restoreWindowPositionFromPrefs:(PrefService*)prefs
- withPath:(const wchar_t*)path {
- DCHECK(prefs);
- // Get the positioning information.
- DictionaryValue* windowPrefs = prefs->GetMutableDictionary(path);
- int x = 0, y = 0;
- windowPrefs->GetInteger(L"x", &x);
- windowPrefs->GetInteger(L"y", &y);
- // Turn the origin (lower-left) into an upper-left window point.
- NSPoint upperLeft = NSMakePoint(x, y + [self frame].size.height);
- NSPoint cascadePoint = [self cascadeTopLeftFromPoint:upperLeft];
- // Cascade again to get the offset when opening new windows.
- [self cascadeTopLeftFromPoint:cascadePoint];
- // Force a save of the pref.
- [self saveWindowPositionToPrefs:prefs withPath:path];
-}
-
-@end

Powered by Google App Engine
This is Rietveld 408576698