| 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/common/pref_member.h" | 9 #include "chrome/common/pref_member.h" |
| 10 | 10 |
| 11 @class CustomHomePagesModel; | 11 @class CustomHomePagesModel; |
| 12 class PrefObserverBridge; | 12 class PrefObserverBridge; |
| 13 class PrefService; | 13 class PrefService; |
| 14 class Profile; | 14 class Profile; |
| 15 class ProfileSyncService; |
| 15 @class SearchEngineListModel; | 16 @class SearchEngineListModel; |
| 16 | 17 |
| 17 // A window controller that handles the preferences window. The bulk of the | 18 // A window controller that handles the preferences window. The bulk of the |
| 18 // work is handled via Cocoa Bindings and getter/setter methods that wrap | 19 // work is handled via Cocoa Bindings and getter/setter methods that wrap |
| 19 // cross-platform PrefMember objects. When prefs change in the back-end | 20 // cross-platform PrefMember objects. When prefs change in the back-end |
| 20 // (that is, outside of this UI), our observer recieves a notification and can | 21 // (that is, outside of this UI), our observer recieves a notification and can |
| 21 // tickle the KVO to update the UI so we are always in sync. The bindings are | 22 // tickle the KVO to update the UI so we are always in sync. The bindings are |
| 22 // specified in the nib file. Preferences are persisted into the back-end | 23 // specified in the nib file. Preferences are persisted into the back-end |
| 23 // as they are changed in the UI, and are thus immediately available even while | 24 // as they are changed in the UI, and are thus immediately available even while |
| 24 // the window is still open. When the window closes, a notification is sent | 25 // the window is still open. When the window closes, a notification is sent |
| 25 // via the system NotificationCenter. This can be used as a signal to | 26 // via the system NotificationCenter. This can be used as a signal to |
| 26 // release this controller, as it's likely the client wants to enforce there | 27 // release this controller, as it's likely the client wants to enforce there |
| 27 // only being one (we don't do that internally as it makes it very difficult | 28 // only being one (we don't do that internally as it makes it very difficult |
| 28 // to unit test). | 29 // to unit test). |
| 29 @interface PreferencesWindowController : NSWindowController { | 30 @interface PreferencesWindowController : NSWindowController { |
| 30 @private | 31 @private |
| 31 Profile* profile_; // weak ref | 32 Profile* profile_; // weak ref |
| 32 PrefService* prefs_; // weak ref - Obtained from profile_ for convenience. | 33 PrefService* prefs_; // weak ref - Obtained from profile_ for convenience. |
| 34 // weak ref - Also obtained from profile_ for convenience. May be NULL. |
| 35 ProfileSyncService* syncService_; |
| 33 scoped_ptr<PrefObserverBridge> observer_; // Watches for pref changes. | 36 scoped_ptr<PrefObserverBridge> observer_; // Watches for pref changes. |
| 34 | 37 |
| 35 IBOutlet NSToolbar* toolbar_; | 38 IBOutlet NSToolbar* toolbar_; |
| 36 | 39 |
| 37 // The views we'll rotate through | 40 // The views we'll rotate through |
| 38 IBOutlet NSView* basicsView_; | 41 IBOutlet NSView* basicsView_; |
| 39 IBOutlet NSView* personalStuffView_; | 42 IBOutlet NSView* personalStuffView_; |
| 40 IBOutlet NSView* underTheHoodView_; | 43 IBOutlet NSView* underTheHoodView_; |
| 41 // The last page the user was on when they opened the Options window. | 44 // The last page the user was on when they opened the Options window. |
| 42 IntegerPrefMember lastSelectedPage_; | 45 IntegerPrefMember lastSelectedPage_; |
| 43 | 46 |
| 44 // The groups of the Basics view for layout fixup. | 47 // The groups of the Basics view for layout fixup. |
| 45 IBOutlet NSArray* basicsGroupStartup_; | 48 IBOutlet NSArray* basicsGroupStartup_; |
| 46 IBOutlet NSArray* basicsGroupHomePage_; | 49 IBOutlet NSArray* basicsGroupHomePage_; |
| 47 IBOutlet NSArray* basicsGroupToolbar_; | 50 IBOutlet NSArray* basicsGroupToolbar_; |
| 48 IBOutlet NSArray* basicsGroupSearchEngine_; | 51 IBOutlet NSArray* basicsGroupSearchEngine_; |
| 49 IBOutlet NSArray* basicsGroupDefaultBrowser_; | 52 IBOutlet NSArray* basicsGroupDefaultBrowser_; |
| 50 | 53 |
| 51 // The groups of the Personal Stuff view for layout fixup. | 54 // The groups of the Personal Stuff view for layout fixup. |
| 55 IBOutlet NSArray* personalStuffGroupSync_; |
| 52 IBOutlet NSArray* personalStuffGroupPasswords_; | 56 IBOutlet NSArray* personalStuffGroupPasswords_; |
| 53 IBOutlet NSArray* personalStuffGroupAutofill_; | 57 IBOutlet NSArray* personalStuffGroupAutofill_; |
| 54 IBOutlet NSArray* personalStuffGroupBrowserData_; | 58 IBOutlet NSArray* personalStuffGroupBrowserData_; |
| 55 IBOutlet NSArray* personalStuffGroupThemes_; | 59 IBOutlet NSArray* personalStuffGroupThemes_; |
| 56 | 60 |
| 57 // Having two animations around is bad (they fight), so just use one. | 61 // Having two animations around is bad (they fight), so just use one. |
| 58 scoped_nsobject<NSViewAnimation> animation_; | 62 scoped_nsobject<NSViewAnimation> animation_; |
| 59 | 63 |
| 60 IBOutlet NSArrayController* customPagesArrayController_; | 64 IBOutlet NSArrayController* customPagesArrayController_; |
| 61 | 65 |
| 62 // Basics panel | 66 // Basics panel |
| 63 IntegerPrefMember restoreOnStartup_; | 67 IntegerPrefMember restoreOnStartup_; |
| 64 scoped_nsobject<CustomHomePagesModel> customPagesSource_; | 68 scoped_nsobject<CustomHomePagesModel> customPagesSource_; |
| 65 BooleanPrefMember newTabPageIsHomePage_; | 69 BooleanPrefMember newTabPageIsHomePage_; |
| 66 StringPrefMember homepage_; | 70 StringPrefMember homepage_; |
| 67 BooleanPrefMember showHomeButton_; | 71 BooleanPrefMember showHomeButton_; |
| 68 BooleanPrefMember showPageOptionButtons_; | 72 BooleanPrefMember showPageOptionButtons_; |
| 69 scoped_nsobject<SearchEngineListModel> searchEngineModel_; | 73 scoped_nsobject<SearchEngineListModel> searchEngineModel_; |
| 70 // Used when creating a new home page url to make the new cell editable. | 74 // Used when creating a new home page url to make the new cell editable. |
| 71 BOOL pendingSelectForEdit_; | 75 BOOL pendingSelectForEdit_; |
| 72 | 76 |
| 73 // User Data panel | 77 // User Data panel |
| 74 BooleanPrefMember askSavePasswords_; | 78 BooleanPrefMember askSavePasswords_; |
| 75 BooleanPrefMember formAutofill_; | 79 BooleanPrefMember formAutofill_; |
| 80 IBOutlet NSButton* syncButton_; |
| 81 IBOutlet NSTextField* syncStatus_; |
| 76 | 82 |
| 77 // Under the hood panel | 83 // Under the hood panel |
| 78 IBOutlet NSView* underTheHoodContentView_; | 84 IBOutlet NSView* underTheHoodContentView_; |
| 79 IBOutlet NSScrollView* underTheHoodScroller_; | 85 IBOutlet NSScrollView* underTheHoodScroller_; |
| 80 BooleanPrefMember alternateErrorPages_; | 86 BooleanPrefMember alternateErrorPages_; |
| 81 BooleanPrefMember useSuggest_; | 87 BooleanPrefMember useSuggest_; |
| 82 BooleanPrefMember dnsPrefetch_; | 88 BooleanPrefMember dnsPrefetch_; |
| 83 BooleanPrefMember safeBrowsing_; | 89 BooleanPrefMember safeBrowsing_; |
| 84 BooleanPrefMember metricsRecording_; | 90 BooleanPrefMember metricsRecording_; |
| 85 IntegerPrefMember cookieBehavior_; | 91 IntegerPrefMember cookieBehavior_; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 105 - (IBAction)removeSelectedHomepages:(id)sender; | 111 - (IBAction)removeSelectedHomepages:(id)sender; |
| 106 - (IBAction)useCurrentPagesAsHomepage:(id)sender; | 112 - (IBAction)useCurrentPagesAsHomepage:(id)sender; |
| 107 - (IBAction)manageSearchEngines:(id)sender; | 113 - (IBAction)manageSearchEngines:(id)sender; |
| 108 | 114 |
| 109 // User Data panel | 115 // User Data panel |
| 110 - (IBAction)showSavedPasswords:(id)sender; | 116 - (IBAction)showSavedPasswords:(id)sender; |
| 111 - (IBAction)importData:(id)sender; | 117 - (IBAction)importData:(id)sender; |
| 112 - (IBAction)clearData:(id)sender; | 118 - (IBAction)clearData:(id)sender; |
| 113 - (IBAction)resetThemeToDefault:(id)sender; | 119 - (IBAction)resetThemeToDefault:(id)sender; |
| 114 - (IBAction)themesGallery:(id)sender; | 120 - (IBAction)themesGallery:(id)sender; |
| 121 - (IBAction)doSyncAction:(id)sender; |
| 115 | 122 |
| 116 // Under the hood | 123 // Under the hood |
| 117 - (IBAction)browseDownloadLocation:(id)sender; | 124 - (IBAction)browseDownloadLocation:(id)sender; |
| 118 - (IBAction)privacyLearnMore:(id)sender; | 125 - (IBAction)privacyLearnMore:(id)sender; |
| 119 | 126 |
| 120 // When a toolbar button is clicked | 127 // When a toolbar button is clicked |
| 121 - (IBAction)toolbarButtonSelected:(id)sender; | 128 - (IBAction)toolbarButtonSelected:(id)sender; |
| 122 | 129 |
| 123 // Usable from cocoa bindings to hook up the custom home pages table. | 130 // Usable from cocoa bindings to hook up the custom home pages table. |
| 124 @property(readonly) CustomHomePagesModel* customPagesSource; | 131 @property(readonly) CustomHomePagesModel* customPagesSource; |
| 125 | 132 |
| 126 // NSNotification sent when the prefs window is closed. | 133 // NSNotification sent when the prefs window is closed. |
| 127 extern NSString* const kUserDoneEditingPrefsNotification; | 134 extern NSString* const kUserDoneEditingPrefsNotification; |
| 128 | 135 |
| 129 @end | 136 @end |
| OLD | NEW |