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

Unified Diff: chrome/browser/cocoa/preferences_window_controller.mm

Issue 102015: Add a very basic preferences window controller with unit test. Fix the prefs ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/cocoa/preferences_window_controller.mm
===================================================================
--- chrome/browser/cocoa/preferences_window_controller.mm (revision 0)
+++ chrome/browser/cocoa/preferences_window_controller.mm (revision 0)
@@ -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 {
+
TVL 2009/04/30 17:50:31 todo?
+}
+
+// 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
« 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