| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |