| 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/browser/content_settings/host_content_settings_map.h" | |
| 10 #include "chrome/common/content_settings_types.h" | |
| 11 | |
| 12 class ContentExceptionsTableModel; | |
| 13 class ContentSettingComboModel; | |
| 14 class UpdatingContentSettingsObserver; | |
| 15 | |
| 16 // Controller for the content exception dialogs. | |
| 17 @interface ContentExceptionsWindowController : NSWindowController | |
| 18 <NSWindowDelegate, | |
| 19 NSTableViewDataSource, | |
| 20 NSTableViewDelegate> { | |
| 21 @private | |
| 22 IBOutlet NSTableView* tableView_; | |
| 23 IBOutlet NSButton* addButton_; | |
| 24 IBOutlet NSButton* removeButton_; | |
| 25 IBOutlet NSButton* removeAllButton_; | |
| 26 IBOutlet NSButton* doneButton_; | |
| 27 | |
| 28 ContentSettingsType settingsType_; | |
| 29 HostContentSettingsMap* settingsMap_; // weak | |
| 30 HostContentSettingsMap* otrSettingsMap_; // weak | |
| 31 scoped_ptr<ContentExceptionsTableModel> model_; | |
| 32 scoped_ptr<ContentSettingComboModel> popup_model_; | |
| 33 | |
| 34 // Is set if adding and editing exceptions for the current OTR session should | |
| 35 // be allowed. | |
| 36 BOOL otrAllowed_; | |
| 37 | |
| 38 // Listens for changes to the content settings and reloads the data when they | |
| 39 // change. See comment in -modelDidChange in the mm file for details. | |
| 40 scoped_ptr<UpdatingContentSettingsObserver> tableObserver_; | |
| 41 | |
| 42 // If this is set to NO, notifications by |tableObserver_| are ignored. This | |
| 43 // is used to suppress updates at bad times. | |
| 44 BOOL updatesEnabled_; | |
| 45 | |
| 46 // This is non-NULL only while a new element is being added and its pattern | |
| 47 // is being edited. | |
| 48 scoped_ptr<HostContentSettingsMap::PatternSettingPair> newException_; | |
| 49 } | |
| 50 | |
| 51 // Returns the content exceptions window controller for |settingsType|. | |
| 52 // Changes made by the user in the window are persisted in |settingsMap|. | |
| 53 + (id)controllerForType:(ContentSettingsType)settingsType | |
| 54 settingsMap:(HostContentSettingsMap*)settingsMap | |
| 55 otrSettingsMap:(HostContentSettingsMap*)otrSettingsMap; | |
| 56 | |
| 57 // Shows the exceptions dialog as a modal sheet attached to |window|. | |
| 58 - (void)attachSheetTo:(NSWindow*)window; | |
| 59 | |
| 60 // Sets the minimum width of the sheet and resizes it if necessary. | |
| 61 - (void)setMinWidth:(CGFloat)minWidth; | |
| 62 | |
| 63 - (IBAction)addException:(id)sender; | |
| 64 - (IBAction)removeException:(id)sender; | |
| 65 - (IBAction)removeAllExceptions:(id)sender; | |
| 66 // Closes the sheet and ends the modal loop. | |
| 67 - (IBAction)closeSheet:(id)sender; | |
| 68 | |
| 69 @end | |
| 70 | |
| 71 @interface ContentExceptionsWindowController(VisibleForTesting) | |
| 72 - (void)cancel:(id)sender; | |
| 73 - (BOOL)editingNewException; | |
| 74 @end | |
| OLD | NEW |