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

Side by Side Diff: chrome/browser/cocoa/preferences_window_controller.mm

Issue 99238: Add notification (and unit test) for closing prefs window so it can be cleane... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/cocoa/preferences_window_controller.h" 5 #import "chrome/browser/cocoa/preferences_window_controller.h"
6 6
7 #include "base/mac_util.h" 7 #include "base/mac_util.h"
8 #include "chrome/common/pref_service.h" 8 #include "chrome/common/pref_service.h"
9 9
10 PreferencesWindowController* gPrefWindowSingleton = nil; 10 NSString* const kUserDoneEditingPrefsNotification =
11 @"kUserDoneEditingPrefsNotification";
11 12
12 @implementation PreferencesWindowController 13 @implementation PreferencesWindowController
13 14
14 - (id)initWithPrefs:(PrefService*)prefs { 15 - (id)initWithPrefs:(PrefService*)prefs {
15 DCHECK(prefs); 16 DCHECK(prefs);
16 // Use initWithWindowNibPath:: instead of initWithWindowNibName: so we 17 // Use initWithWindowNibPath:: instead of initWithWindowNibName: so we
17 // can override it in a unit test. 18 // can override it in a unit test.
18 NSString *nibpath = [mac_util::MainAppBundle() 19 NSString *nibpath = [mac_util::MainAppBundle()
19 pathForResource:@"Preferences" 20 pathForResource:@"Preferences"
20 ofType:@"nib"]; 21 ofType:@"nib"];
(...skipping 14 matching lines...) Expand all
35 36
36 // Show the preferences window. 37 // Show the preferences window.
37 - (IBAction)showPreferences:(id)sender { 38 - (IBAction)showPreferences:(id)sender {
38 [self syncWithPrefs]; 39 [self syncWithPrefs];
39 [self showWindow:sender]; 40 [self showWindow:sender];
40 } 41 }
41 42
42 // Called when the window is being closed. Send out a notification that the 43 // Called when the window is being closed. Send out a notification that the
43 // user is done editing preferences. 44 // user is done editing preferences.
44 - (void)windowWillClose:(NSNotification *)notification { 45 - (void)windowWillClose:(NSNotification *)notification {
45 // TODO(pinkerton): send notification. Write unit test that makes sure 46 [[NSNotificationCenter defaultCenter]
46 // we receive it. 47 postNotificationName:kUserDoneEditingPrefsNotification
48 object:self];
47 } 49 }
48 50
49 @end 51 @end
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/preferences_window_controller.h ('k') | chrome/browser/cocoa/preferences_window_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698