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

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

Issue 7544037: Session restore by default should account for uninitialized state (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/window_restore_utils.h" 5 #import "chrome/browser/ui/cocoa/window_restore_utils.h"
6 6
7 #import <Foundation/Foundation.h> 7 #import <Foundation/Foundation.h>
8 8
9 #include "base/mac/mac_util.h" 9 #include "base/mac/mac_util.h"
10 10
11 namespace restore_utils { 11 namespace restore_utils {
12 12
13 bool IsWindowRestoreEnabled() { 13 bool IsWindowRestoreEnabled() {
14 if (!base::mac::IsOSLionOrLater()) 14 if (!base::mac::IsOSLionOrLater())
15 return false; 15 return false;
16 16
17 NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; 17 NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
18 // The defaults must be synchronized here otherwise a stale value will be 18 // The defaults must be synchronized here otherwise a stale value will be
19 // returned for an indeterminate amount of time. 19 // returned for an indeterminate amount of time.
20 [defaults synchronize]; 20 [defaults synchronize];
21 return !![defaults boolForKey:@"NSQuitAlwaysKeepsWindows"]; 21
22 // By default, the preference is not set. When it's not, the intrinsic Lion
23 // default (YES) should be returned.
24 NSDictionary* prefs = [defaults dictionaryRepresentation];
25 NSNumber* value = [prefs objectForKey:@"NSQuitAlwaysKeepsWindows"];
26 if (!value)
27 return true;
28
29 return !![value boolValue];
22 } 30 }
23 31
24 } // namespace restore_utils 32 } // namespace restore_utils
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698