OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #import <Cocoa/Cocoa.h> | |
6 | |
7 #import "base/mac/cocoa_protocols.h" | |
8 #include "base/scoped_ptr.h" | |
9 #include "chrome/common/content_settings_types.h" | |
10 #include "chrome/browser/prefs/pref_change_registrar.h" | |
11 #include "chrome/browser/prefs/pref_member.h" | |
12 | |
13 // Index of the "enabled" and "disabled" radio group settings in all tabs except | |
14 // the ones below. | |
15 const NSInteger kContentSettingsEnabledIndex = 0; | |
16 const NSInteger kContentSettingsDisabledIndex = 1; | |
17 | |
18 // Indices of the various cookie settings in the cookie radio group. | |
19 const NSInteger kCookieEnabledIndex = 0; | |
20 const NSInteger kCookieDisabledIndex = 1; | |
21 | |
22 // Indices of the various plugin settings in the plugins radio group. | |
23 const NSInteger kPluginsAllowIndex = 0; | |
24 const NSInteger kPluginsAskIndex = 1; | |
25 const NSInteger kPluginsBlockIndex = 2; | |
26 | |
27 // Indices of the various geolocation settings in the geolocation radio group. | |
28 const NSInteger kGeolocationEnabledIndex = 0; | |
29 const NSInteger kGeolocationAskIndex = 1; | |
30 const NSInteger kGeolocationDisabledIndex = 2; | |
31 | |
32 // Indices of the various notifications settings in the geolocation radio group. | |
33 const NSInteger kNotificationsEnabledIndex = 0; | |
34 const NSInteger kNotificationsAskIndex = 1; | |
35 const NSInteger kNotificationsDisabledIndex = 2; | |
36 | |
37 namespace ContentSettingsDialogControllerInternal { | |
38 class PrefObserverBridge; | |
39 } | |
40 | |
41 class Profile; | |
42 @class TabViewPickerTable; | |
43 | |
44 // This controller manages a dialog that lets the user manage the content | |
45 // settings for several content setting types. | |
46 @interface ContentSettingsDialogController | |
47 : NSWindowController<NSWindowDelegate, NSTabViewDelegate> { | |
48 @private | |
49 IBOutlet NSTabView* tabView_; | |
50 IBOutlet TabViewPickerTable* tabViewPicker_; | |
51 IBOutlet NSMatrix* pluginDefaultSettingMatrix_; | |
52 Profile* profile_; // weak | |
53 IntegerPrefMember lastSelectedTab_; | |
54 BooleanPrefMember clearSiteDataOnExit_; | |
55 PrefChangeRegistrar registrar_; | |
56 scoped_ptr<ContentSettingsDialogControllerInternal::PrefObserverBridge> | |
57 observer_; // Watches for pref changes. | |
58 } | |
59 | |
60 // Show the content settings dialog associated with the given profile (or the | |
61 // original profile if this is an incognito profile). If no content settings | |
62 // dialog exists for this profile, create one and show it. Any resulting | |
63 // editor releases itself when closed. | |
64 +(id)showContentSettingsForType:(ContentSettingsType)settingsType | |
65 profile:(Profile*)profile; | |
66 | |
67 // Closes an exceptions sheet, if one is attached. | |
68 - (void)closeExceptionsSheet; | |
69 | |
70 - (IBAction)showCookies:(id)sender; | |
71 - (IBAction)openFlashPlayerSettings:(id)sender; | |
72 - (IBAction)openPluginsPage:(id)sender; | |
73 | |
74 - (IBAction)showCookieExceptions:(id)sender; | |
75 - (IBAction)showImagesExceptions:(id)sender; | |
76 - (IBAction)showJavaScriptExceptions:(id)sender; | |
77 - (IBAction)showPluginsExceptions:(id)sender; | |
78 - (IBAction)showPopupsExceptions:(id)sender; | |
79 - (IBAction)showGeolocationExceptions:(id)sender; | |
80 - (IBAction)showNotificationsExceptions:(id)sender; | |
81 | |
82 @end | |
83 | |
84 @interface ContentSettingsDialogController (TestingAPI) | |
85 // Properties that the radio groups and checkboxes are bound to. | |
86 @property(nonatomic) NSInteger cookieSettingIndex; | |
87 @property(nonatomic) BOOL blockThirdPartyCookies; | |
88 @property(nonatomic) BOOL clearSiteDataOnExit; | |
89 @property(nonatomic) NSInteger imagesEnabledIndex; | |
90 @property(nonatomic) NSInteger javaScriptEnabledIndex; | |
91 @property(nonatomic) NSInteger popupsEnabledIndex; | |
92 @property(nonatomic) NSInteger pluginsEnabledIndex; | |
93 @property(nonatomic) NSInteger geolocationSettingIndex; | |
94 @property(nonatomic) NSInteger notificationsSettingIndex; | |
95 | |
96 @property(nonatomic, readonly) BOOL blockThirdPartyCookiesManaged; | |
97 @property(nonatomic, readonly) BOOL cookieSettingsManaged; | |
98 @property(nonatomic, readonly) BOOL imagesSettingsManaged; | |
99 @property(nonatomic, readonly) BOOL javaScriptSettingsManaged; | |
100 @property(nonatomic, readonly) BOOL pluginsSettingsManaged; | |
101 @property(nonatomic, readonly) BOOL popupsSettingsManaged; | |
102 @end | |
OLD | NEW |