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

Side by Side Diff: chrome/browser/cocoa/preferences_window_controller.h

Issue 2831004: Managed preferences warning banner for Mac preferences dialog (Closed)
Patch Set: rebase, take care of comments. Created 10 years, 6 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 unified diff | Download patch
OLDNEW
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/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 class ManagedPrefsBannerState;
14 } 15 }
15 16
16 @class CustomHomePagesModel; 17 @class CustomHomePagesModel;
17 @class FontLanguageSettingsController; 18 @class FontLanguageSettingsController;
18 class PrefService; 19 class PrefService;
19 class Profile; 20 class Profile;
20 class ProfileSyncService; 21 class ProfileSyncService;
21 @class SearchEngineListModel; 22 @class SearchEngineListModel;
23 @class VerticalGradientView;
22 @class WindowSizeAutosaver; 24 @class WindowSizeAutosaver;
23 25
24 // A window controller that handles the preferences window. The bulk of the 26 // A window controller that handles the preferences window. The bulk of the
25 // work is handled via Cocoa Bindings and getter/setter methods that wrap 27 // work is handled via Cocoa Bindings and getter/setter methods that wrap
26 // cross-platform PrefMember objects. When prefs change in the back-end 28 // cross-platform PrefMember objects. When prefs change in the back-end
27 // (that is, outside of this UI), our observer receives a notification and can 29 // (that is, outside of this UI), our observer receives a notification and can
28 // tickle the KVO to update the UI so we are always in sync. The bindings are 30 // tickle the KVO to update the UI so we are always in sync. The bindings are
29 // specified in the nib file. Preferences are persisted into the back-end 31 // specified in the nib file. Preferences are persisted into the back-end
30 // as they are changed in the UI, and are thus immediately available even while 32 // as they are changed in the UI, and are thus immediately available even while
31 // the window is still open. When the window closes, a notification is sent 33 // the window is still open. When the window closes, a notification is sent
32 // via the system NotificationCenter. This can be used as a signal to 34 // via the system NotificationCenter. This can be used as a signal to
33 // release this controller, as it's likely the client wants to enforce there 35 // release this controller, as it's likely the client wants to enforce there
34 // only being one (we don't do that internally as it makes it very difficult 36 // only being one (we don't do that internally as it makes it very difficult
35 // to unit test). 37 // to unit test).
36 @interface PreferencesWindowController : NSWindowController { 38 @interface PreferencesWindowController : NSWindowController {
37 @private 39 @private
38 Profile* profile_; // weak ref 40 Profile* profile_; // weak ref
39 OptionsPage initialPage_; 41 OptionsPage initialPage_;
40 PrefService* prefs_; // weak ref - Obtained from profile_ for convenience. 42 PrefService* prefs_; // weak ref - Obtained from profile_ for convenience.
41 // weak ref - Also obtained from profile_ for convenience. May be NULL. 43 // weak ref - Also obtained from profile_ for convenience. May be NULL.
42 ProfileSyncService* syncService_; 44 ProfileSyncService* syncService_;
43 scoped_ptr<PreferencesWindowControllerInternal::PrefObserverBridge> 45 scoped_ptr<PreferencesWindowControllerInternal::PrefObserverBridge>
44 observer_; // Watches for pref changes. 46 observer_; // Watches for pref changes.
45 scoped_nsobject<WindowSizeAutosaver> sizeSaver_; 47 scoped_nsobject<WindowSizeAutosaver> sizeSaver_;
48 NSView* currentPrefsView_; // weak ref - current prefs page view.
49 scoped_ptr<PreferencesWindowControllerInternal::ManagedPrefsBannerState>
50 bannerState_;
51 BOOL managedPrefsBannerVisible_;
46 52
47 IBOutlet NSToolbar* toolbar_; 53 IBOutlet NSToolbar* toolbar_;
54 IBOutlet VerticalGradientView* managedPrefsBannerView_;
55 IBOutlet NSImageView* managedPrefsBannerWarningImage_;
48 56
49 // The views we'll rotate through 57 // The views we'll rotate through
50 IBOutlet NSView* basicsView_; 58 IBOutlet NSView* basicsView_;
51 IBOutlet NSView* personalStuffView_; 59 IBOutlet NSView* personalStuffView_;
52 IBOutlet NSView* underTheHoodView_; 60 IBOutlet NSView* underTheHoodView_;
53 // The last page the user was on when they opened the Options window. 61 // The last page the user was on when they opened the Options window.
54 IntegerPrefMember lastSelectedPage_; 62 IntegerPrefMember lastSelectedPage_;
55 63
56 // The groups of the Basics view for layout fixup. 64 // The groups of the Basics view for layout fixup.
57 IBOutlet NSArray* basicsGroupStartup_; 65 IBOutlet NSArray* basicsGroupStartup_;
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 // Returns the (normalized) page corresponding to the given toolbar item. 191 // Returns the (normalized) page corresponding to the given toolbar item.
184 // Should be called only after awakeFromNib is. 192 // Should be called only after awakeFromNib is.
185 - (OptionsPage)getPageForToolbarItem:(NSToolbarItem*)toolbarItem; 193 - (OptionsPage)getPageForToolbarItem:(NSToolbarItem*)toolbarItem;
186 194
187 // Returns the view corresponding to the given page. Should be called 195 // Returns the view corresponding to the given page. Should be called
188 // only after awakeFromNib is. 196 // only after awakeFromNib is.
189 - (NSView*)getPrefsViewForPage:(OptionsPage)page; 197 - (NSView*)getPrefsViewForPage:(OptionsPage)page;
190 198
191 @end 199 @end
192 200
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/infobar_gradient_view.mm ('k') | chrome/browser/cocoa/preferences_window_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698