Index: chrome/browser/cocoa/page_info_window_controller.mm |
diff --git a/chrome/browser/cocoa/page_info_window_controller.mm b/chrome/browser/cocoa/page_info_window_controller.mm |
index 04c8049ab268673f6b0ecbbe2e85bd2a1d85a137..144cfcb4db38abeb41e1732f41f1a0eb7e7eae9a 100644 |
--- a/chrome/browser/cocoa/page_info_window_controller.mm |
+++ b/chrome/browser/cocoa/page_info_window_controller.mm |
@@ -8,17 +8,12 @@ |
#include "base/mac_util.h" |
#include "base/values.h" |
#include "chrome/browser/browser_process.h" |
-#import "chrome/browser/cocoa/nswindow_local_state.h" |
#include "chrome/browser/cocoa/page_info_window_mac.h" |
+#include "chrome/browser/cocoa/window_size_autosaver.h" |
#include "chrome/common/pref_names.h" |
#include "chrome/common/pref_service.h" |
#include "grit/theme_resources.h" |
-@interface PageInfoWindowController (Private) |
-// Saves the window preference to the local state. |
-- (void)saveWindowPositionToLocalState; |
-@end |
- |
@implementation PageInfoWindowController |
@synthesize identityImg = identityImg_; |
@synthesize connectionImg = connectionImg_; |
@@ -36,18 +31,24 @@ |
ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
goodImg_.reset([rb.GetNSImageNamed(IDR_PAGEINFO_GOOD) retain]); |
badImg_.reset([rb.GetNSImageNamed(IDR_PAGEINFO_BAD) retain]); |
+ |
+ if (g_browser_process && g_browser_process->local_state()) { |
+ sizeSaver_.reset([[WindowSizeAutosaver alloc] |
+ initWithWindow:[self window] |
+ prefService:g_browser_process->local_state() |
+ path:prefs::kPageInfoWindowPlacement |
+ state:kSaveWindowPos]); |
+ // Cascade again to get the offset when opening new windows. |
+ NSRect frame = [[self window] frame]; |
+ NSPoint cascadePoint = [[self window] |
+ cascadeTopLeftFromPoint:NSMakePoint(NSMinX(frame), NSMaxY(frame))]; |
+ [[self window] cascadeTopLeftFromPoint:cascadePoint]; |
+ } |
} |
return self; |
} |
- (void)awakeFromNib { |
- if (g_browser_process && g_browser_process->local_state()) { |
- // Get the positioning information. |
- PrefService* prefs = g_browser_process->local_state(); |
- [[self window] restoreWindowPositionFromPrefs:prefs |
- withPath:prefs::kPageInfoWindowPlacement]; |
- } |
- |
// By default, assume we have no history information. |
[self setShowHistoryBox:NO]; |
} |
@@ -103,12 +104,4 @@ |
[self autorelease]; |
} |
-// The last page info window that was moved will determine the location of the |
-// next new one. |
-- (void)windowDidMove:(NSNotification*)notif { |
- if (g_browser_process && g_browser_process->local_state()) |
- [[self window] saveWindowPositionToPrefs:g_browser_process->local_state() |
- withPath:prefs::kPageInfoWindowPlacement]; |
-} |
- |
@end |