Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #import "chrome/browser/cocoa/preferences_window_controller.h" | |
| 6 | |
| 7 #include "base/mac_util.h" | |
| 8 #include "chrome/common/pref_service.h" | |
| 9 | |
| 10 PreferencesWindowController* gPrefWindowSingleton = nil; | |
| 11 | |
| 12 @implementation PreferencesWindowController | |
| 13 | |
| 14 - (id)initWithPrefs:(PrefService*)prefs { | |
| 15 DCHECK(prefs); | |
| 16 // Use initWithWindowNibPath:: instead of initWithWindowNibName: so we | |
| 17 // can override it in a unit test. | |
| 18 NSString *nibpath = [mac_util::MainAppBundle() | |
| 19 pathForResource:@"Preferences" | |
| 20 ofType:@"nib"]; | |
| 21 if ((self = [super initWithWindowNibPath:nibpath owner:self])) { | |
| 22 prefs_ = prefs; | |
| 23 } | |
| 24 return self; | |
| 25 } | |
| 26 | |
| 27 - (void)awakeFromNib { | |
| 28 | |
|
TVL
2009/04/30 17:50:31
todo?
| |
| 29 } | |
| 30 | |
| 31 // Synchronizes the window's UI elements with the values in |prefs_|. | |
| 32 - (void)syncWithPrefs { | |
| 33 // TODO(pinkerton): do it... | |
| 34 } | |
| 35 | |
| 36 // Show the preferences window. | |
| 37 - (IBAction)showPreferences:(id)sender { | |
| 38 [self syncWithPrefs]; | |
| 39 [self showWindow:sender]; | |
| 40 } | |
| 41 | |
| 42 // Called when the window is being closed. Send out a notification that the | |
| 43 // user is done editing preferences. | |
| 44 - (void)windowWillClose:(NSNotification *)notification { | |
| 45 // TODO(pinkerton): send notification. Write unit test that makes sure | |
| 46 // we receive it. | |
| 47 } | |
| 48 | |
| 49 @end | |
| OLD | NEW |