diff options
author | pinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-30 17:59:24 +0000 |
---|---|---|
committer | pinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-30 17:59:24 +0000 |
commit | 4240438bc0860628bc93b59c291c9a4b6f69d2ff (patch) | |
tree | 6fa475044ba9b83cdb1e4290da649cb04ddaa9c7 /chrome/browser/cocoa/preferences_window_controller.mm | |
parent | 75e287db9508753ada184ee4252b679912f6f085 (diff) | |
download | chromium_src-4240438bc0860628bc93b59c291c9a4b6f69d2ff.zip chromium_src-4240438bc0860628bc93b59c291c9a4b6f69d2ff.tar.gz chromium_src-4240438bc0860628bc93b59c291c9a4b6f69d2ff.tar.bz2 |
Add a very basic preferences window controller with unit test. Fix the prefs nib to know the FileOwner is a NSWindowController and hook them together.
Review URL: http://codereview.chromium.org/102015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14958 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/preferences_window_controller.mm')
-rw-r--r-- | chrome/browser/cocoa/preferences_window_controller.mm | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/preferences_window_controller.mm b/chrome/browser/cocoa/preferences_window_controller.mm new file mode 100644 index 0000000..941d6b3 --- /dev/null +++ b/chrome/browser/cocoa/preferences_window_controller.mm @@ -0,0 +1,49 @@ +// Copyright (c) 2009 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. + +#import "chrome/browser/cocoa/preferences_window_controller.h" + +#include "base/mac_util.h" +#include "chrome/common/pref_service.h" + +PreferencesWindowController* gPrefWindowSingleton = nil; + +@implementation PreferencesWindowController + +- (id)initWithPrefs:(PrefService*)prefs { + DCHECK(prefs); + // Use initWithWindowNibPath:: instead of initWithWindowNibName: so we + // can override it in a unit test. + NSString *nibpath = [mac_util::MainAppBundle() + pathForResource:@"Preferences" + ofType:@"nib"]; + if ((self = [super initWithWindowNibPath:nibpath owner:self])) { + prefs_ = prefs; + } + return self; +} + +- (void)awakeFromNib { + +} + +// Synchronizes the window's UI elements with the values in |prefs_|. +- (void)syncWithPrefs { + // TODO(pinkerton): do it... +} + +// Show the preferences window. +- (IBAction)showPreferences:(id)sender { + [self syncWithPrefs]; + [self showWindow:sender]; +} + +// Called when the window is being closed. Send out a notification that the +// user is done editing preferences. +- (void)windowWillClose:(NSNotification *)notification { + // TODO(pinkerton): send notification. Write unit test that makes sure + // we receive it. +} + +@end |