Index: chrome/browser/ui/cocoa/window_size_autosaver.mm |
diff --git a/chrome/browser/ui/cocoa/window_size_autosaver.mm b/chrome/browser/ui/cocoa/window_size_autosaver.mm |
index 5ca987836a8b06f2413c450d736d89a0d055e1cb..07f9abf000123427633c66b31f01047c72c89586 100644 |
--- a/chrome/browser/ui/cocoa/window_size_autosaver.mm |
+++ b/chrome/browser/ui/cocoa/window_size_autosaver.mm |
@@ -1,4 +1,4 @@ |
-// Copyright (c) 2010 The Chromium Authors. All rights reserved. |
+// Copyright (c) 2011 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. |
@@ -7,6 +7,7 @@ |
#import "chrome/browser/ui/cocoa/window_size_autosaver.h" |
#include "chrome/browser/prefs/pref_service.h" |
+#include "chrome/browser/prefs/scoped_user_pref_update.h" |
// If the window width stored in the prefs is smaller than this, the size is |
// not restored but instead cleared from the profile -- to protect users from |
@@ -52,7 +53,8 @@ const int kMinWindowHeight = 17; |
} |
- (void)save:(NSNotification*)notification { |
- DictionaryValue* windowPrefs = prefService_->GetMutableDictionary(path_); |
+ DictionaryPrefUpdate update(prefService_, path_); |
+ DictionaryValue* windowPrefs = update.Get(); |
NSRect frame = [window_ frame]; |
if ([window_ styleMask] & NSResizableWindowMask) { |
// Save the origin of the window. |
@@ -72,7 +74,8 @@ const int kMinWindowHeight = 17; |
- (void)restore { |
// Get the positioning information. |
- DictionaryValue* windowPrefs = prefService_->GetMutableDictionary(path_); |
+ DictionaryPrefUpdate update(prefService_, path_); |
+ DictionaryValue* windowPrefs = update.Get(); |
if ([window_ styleMask] & NSResizableWindowMask) { |
int x1, x2, y1, y2; |
if (!windowPrefs->GetInteger("left", &x1) || |