OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/prefs/pref_member.h" | 9 #include "chrome/browser/prefs/pref_member.h" |
10 #include "chrome/browser/prefs/pref_set_observer.h" | 10 #include "chrome/browser/prefs/pref_set_observer.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 // the window is still open. When the window closes, a notification is sent | 35 // the window is still open. When the window closes, a notification is sent |
36 // via the system NotificationCenter. This can be used as a signal to | 36 // via the system NotificationCenter. This can be used as a signal to |
37 // release this controller, as it's likely the client wants to enforce there | 37 // release this controller, as it's likely the client wants to enforce there |
38 // only being one (we don't do that internally as it makes it very difficult | 38 // only being one (we don't do that internally as it makes it very difficult |
39 // to unit test). | 39 // to unit test). |
40 @interface PreferencesWindowController : NSWindowController { | 40 @interface PreferencesWindowController : NSWindowController { |
41 @private | 41 @private |
42 Profile* profile_; // weak ref | 42 Profile* profile_; // weak ref |
43 OptionsPage initialPage_; | 43 OptionsPage initialPage_; |
44 PrefService* prefs_; // weak ref - Obtained from profile_ for convenience. | 44 PrefService* prefs_; // weak ref - Obtained from profile_ for convenience. |
| 45 PrefService* local_state_; // weak ref - Obtained from TestingProfile or NULL. |
45 // weak ref - Also obtained from profile_ for convenience. May be NULL. | 46 // weak ref - Also obtained from profile_ for convenience. May be NULL. |
46 ProfileSyncService* syncService_; | 47 ProfileSyncService* syncService_; |
47 scoped_ptr<PreferencesWindowControllerInternal::PrefObserverBridge> | 48 scoped_ptr<PreferencesWindowControllerInternal::PrefObserverBridge> |
48 observer_; // Watches for pref changes. | 49 observer_; // Watches for pref changes. |
49 PrefChangeRegistrar registrar_; // Manages pref change observer registration. | 50 PrefChangeRegistrar registrar_; // Manages pref change observer registration. |
50 scoped_nsobject<WindowSizeAutosaver> sizeSaver_; | 51 scoped_nsobject<WindowSizeAutosaver> sizeSaver_; |
51 NSView* currentPrefsView_; // weak ref - current prefs page view. | 52 NSView* currentPrefsView_; // weak ref - current prefs page view. |
52 scoped_ptr<PreferencesWindowControllerInternal::ManagedPrefsBannerState> | 53 scoped_ptr<PreferencesWindowControllerInternal::ManagedPrefsBannerState> |
53 bannerState_; | 54 bannerState_; |
54 BOOL managedPrefsBannerVisible_; | 55 BOOL managedPrefsBannerVisible_; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 @property(nonatomic) BOOL passwordManagerChoiceEnabled; | 159 @property(nonatomic) BOOL passwordManagerChoiceEnabled; |
159 @property(nonatomic) BOOL passwordManagerButtonEnabled; | 160 @property(nonatomic) BOOL passwordManagerButtonEnabled; |
160 @property(nonatomic) BOOL autoFillSettingsButtonEnabled; | 161 @property(nonatomic) BOOL autoFillSettingsButtonEnabled; |
161 @property(nonatomic) BOOL showAlternateErrorPagesEnabled; | 162 @property(nonatomic) BOOL showAlternateErrorPagesEnabled; |
162 @property(nonatomic) BOOL useSuggestEnabled; | 163 @property(nonatomic) BOOL useSuggestEnabled; |
163 @property(nonatomic) BOOL dnsPrefetchEnabled; | 164 @property(nonatomic) BOOL dnsPrefetchEnabled; |
164 @property(nonatomic) BOOL safeBrowsingEnabled; | 165 @property(nonatomic) BOOL safeBrowsingEnabled; |
165 @property(nonatomic) BOOL metricsReportingEnabled; | 166 @property(nonatomic) BOOL metricsReportingEnabled; |
166 @property(nonatomic) BOOL proxiesConfigureButtonEnabled; | 167 @property(nonatomic) BOOL proxiesConfigureButtonEnabled; |
167 | 168 |
| 169 // Designated for testing. |profile| should not be NULL. |
| 170 - (id)initWithProfile:(Profile*)profile localState:(PrefService*)local_state |
| 171 initialPage:(OptionsPage)initialPage; |
| 172 |
168 // Designated initializer. |profile| should not be NULL. | 173 // Designated initializer. |profile| should not be NULL. |
169 - (id)initWithProfile:(Profile*)profile initialPage:(OptionsPage)initialPage; | 174 - (id)initWithProfile:(Profile*)profile initialPage:(OptionsPage)initialPage; |
170 | 175 |
171 // Show the preferences window. | 176 // Show the preferences window. |
172 - (void)showPreferences:(id)sender; | 177 - (void)showPreferences:(id)sender; |
173 | 178 |
174 // Switch to the given preference page. | 179 // Switch to the given preference page. |
175 - (void)switchToPage:(OptionsPage)page animate:(BOOL)animate; | 180 - (void)switchToPage:(OptionsPage)page animate:(BOOL)animate; |
176 | 181 |
177 // Enables or disables the restoreOnStartup elements | 182 // Enables or disables the restoreOnStartup elements |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 | 238 |
234 // Returns the (normalized) page corresponding to the given toolbar item. | 239 // Returns the (normalized) page corresponding to the given toolbar item. |
235 // Should be called only after awakeFromNib is. | 240 // Should be called only after awakeFromNib is. |
236 - (OptionsPage)getPageForToolbarItem:(NSToolbarItem*)toolbarItem; | 241 - (OptionsPage)getPageForToolbarItem:(NSToolbarItem*)toolbarItem; |
237 | 242 |
238 // Returns the view corresponding to the given page. Should be called | 243 // Returns the view corresponding to the given page. Should be called |
239 // only after awakeFromNib is. | 244 // only after awakeFromNib is. |
240 - (NSView*)getPrefsViewForPage:(OptionsPage)page; | 245 - (NSView*)getPrefsViewForPage:(OptionsPage)page; |
241 | 246 |
242 @end | 247 @end |
OLD | NEW |