| 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 <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 | 6 |
| 7 #include "base/scoped_ptr.h" | 7 #include "base/scoped_ptr.h" |
| 8 #include "base/scoped_nsobject.h" | 8 #include "base/scoped_nsobject.h" |
| 9 #include "chrome/browser/options_window.h" | 9 #include "chrome/browser/options_window.h" |
| 10 #include "chrome/browser/pref_member.h" | 10 #include "chrome/browser/pref_member.h" |
| 11 | 11 |
| 12 namespace PreferencesWindowControllerInternal { | 12 namespace PreferencesWindowControllerInternal { |
| 13 class PrefObserverBridge; | 13 class PrefObserverBridge; |
| 14 } | 14 } |
| 15 | 15 |
| 16 @class CustomHomePagesModel; | 16 @class CustomHomePagesModel; |
| 17 @class FontLanguageSettingsController; | 17 @class FontLanguageSettingsController; |
| 18 class PrefService; | 18 class PrefService; |
| 19 class Profile; | 19 class Profile; |
| 20 class ProfileSyncService; | 20 class ProfileSyncService; |
| 21 @class SearchEngineListModel; | 21 @class SearchEngineListModel; |
| 22 @class WindowSizeAutosaver; |
| 22 | 23 |
| 23 // A window controller that handles the preferences window. The bulk of the | 24 // A window controller that handles the preferences window. The bulk of the |
| 24 // work is handled via Cocoa Bindings and getter/setter methods that wrap | 25 // work is handled via Cocoa Bindings and getter/setter methods that wrap |
| 25 // cross-platform PrefMember objects. When prefs change in the back-end | 26 // cross-platform PrefMember objects. When prefs change in the back-end |
| 26 // (that is, outside of this UI), our observer receives a notification and can | 27 // (that is, outside of this UI), our observer receives a notification and can |
| 27 // tickle the KVO to update the UI so we are always in sync. The bindings are | 28 // tickle the KVO to update the UI so we are always in sync. The bindings are |
| 28 // specified in the nib file. Preferences are persisted into the back-end | 29 // specified in the nib file. Preferences are persisted into the back-end |
| 29 // as they are changed in the UI, and are thus immediately available even while | 30 // as they are changed in the UI, and are thus immediately available even while |
| 30 // the window is still open. When the window closes, a notification is sent | 31 // the window is still open. When the window closes, a notification is sent |
| 31 // via the system NotificationCenter. This can be used as a signal to | 32 // via the system NotificationCenter. This can be used as a signal to |
| 32 // release this controller, as it's likely the client wants to enforce there | 33 // release this controller, as it's likely the client wants to enforce there |
| 33 // only being one (we don't do that internally as it makes it very difficult | 34 // only being one (we don't do that internally as it makes it very difficult |
| 34 // to unit test). | 35 // to unit test). |
| 35 @interface PreferencesWindowController : NSWindowController { | 36 @interface PreferencesWindowController : NSWindowController { |
| 36 @private | 37 @private |
| 37 Profile* profile_; // weak ref | 38 Profile* profile_; // weak ref |
| 38 OptionsPage initialPage_; | 39 OptionsPage initialPage_; |
| 39 PrefService* prefs_; // weak ref - Obtained from profile_ for convenience. | 40 PrefService* prefs_; // weak ref - Obtained from profile_ for convenience. |
| 40 // weak ref - Also obtained from profile_ for convenience. May be NULL. | 41 // weak ref - Also obtained from profile_ for convenience. May be NULL. |
| 41 ProfileSyncService* syncService_; | 42 ProfileSyncService* syncService_; |
| 42 scoped_ptr<PreferencesWindowControllerInternal::PrefObserverBridge> | 43 scoped_ptr<PreferencesWindowControllerInternal::PrefObserverBridge> |
| 43 observer_; // Watches for pref changes. | 44 observer_; // Watches for pref changes. |
| 45 scoped_nsobject<WindowSizeAutosaver> sizeSaver_; |
| 44 | 46 |
| 45 IBOutlet NSToolbar* toolbar_; | 47 IBOutlet NSToolbar* toolbar_; |
| 46 | 48 |
| 47 // The views we'll rotate through | 49 // The views we'll rotate through |
| 48 IBOutlet NSView* basicsView_; | 50 IBOutlet NSView* basicsView_; |
| 49 IBOutlet NSView* personalStuffView_; | 51 IBOutlet NSView* personalStuffView_; |
| 50 IBOutlet NSView* underTheHoodView_; | 52 IBOutlet NSView* underTheHoodView_; |
| 51 // The last page the user was on when they opened the Options window. | 53 // The last page the user was on when they opened the Options window. |
| 52 IntegerPrefMember lastSelectedPage_; | 54 IntegerPrefMember lastSelectedPage_; |
| 53 | 55 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 // Returns the (normalized) page corresponding to the given toolbar item. | 183 // Returns the (normalized) page corresponding to the given toolbar item. |
| 182 // Should be called only after awakeFromNib is. | 184 // Should be called only after awakeFromNib is. |
| 183 - (OptionsPage)getPageForToolbarItem:(NSToolbarItem*)toolbarItem; | 185 - (OptionsPage)getPageForToolbarItem:(NSToolbarItem*)toolbarItem; |
| 184 | 186 |
| 185 // Returns the view corresponding to the given page. Should be called | 187 // Returns the view corresponding to the given page. Should be called |
| 186 // only after awakeFromNib is. | 188 // only after awakeFromNib is. |
| 187 - (NSView*)getPrefsViewForPage:(OptionsPage)page; | 189 - (NSView*)getPrefsViewForPage:(OptionsPage)page; |
| 188 | 190 |
| 189 @end | 191 @end |
| 190 | 192 |
| OLD | NEW |