| 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 <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/cocoa_protocols_mac.h" | 9 #include "base/cocoa_protocols_mac.h" |
| 10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
| 11 #include "chrome/browser/host_content_settings_map.h" | 11 #include "chrome/browser/host_content_settings_map.h" |
| 12 #include "chrome/common/content_settings_types.h" | 12 #include "chrome/common/content_settings_types.h" |
| 13 | 13 |
| 14 class ContentExceptionsTableModel; | 14 class ContentExceptionsTableModel; |
| 15 class UpdatingContentSettingsObserver; | 15 class ContentExceptionsTableModelObserver; |
| 16 | 16 |
| 17 // Controller for the content exception dialogs. | 17 // Controller for the content exception dialogs. |
| 18 @interface ContentExceptionsWindowController : NSWindowController | 18 @interface ContentExceptionsWindowController : NSWindowController |
| 19 <NSWindowDelegate, | 19 <NSWindowDelegate, |
| 20 NSTableViewDataSource, | 20 NSTableViewDataSource, |
| 21 NSTableViewDelegate> { | 21 NSTableViewDelegate> { |
| 22 @private | 22 @private |
| 23 IBOutlet NSTableView* tableView_; | 23 IBOutlet NSTableView* tableView_; |
| 24 IBOutlet NSButton* addButton_; | 24 IBOutlet NSButton* addButton_; |
| 25 IBOutlet NSButton* removeButton_; | 25 IBOutlet NSButton* removeButton_; |
| 26 IBOutlet NSButton* removeAllButton_; | 26 IBOutlet NSButton* removeAllButton_; |
| 27 | 27 |
| 28 ContentSettingsType settingsType_; | 28 ContentSettingsType settingsType_; |
| 29 HostContentSettingsMap* settingsMap_; // weak | 29 HostContentSettingsMap* settingsMap_; // weak |
| 30 scoped_ptr<ContentExceptionsTableModel> model_; | 30 scoped_ptr<ContentExceptionsTableModel> model_; |
| 31 | 31 |
| 32 // Is set if "Ask" should be a valid option in the "action" popup. | 32 // Is set if "Ask" should be a valid option in the "action" popup. |
| 33 BOOL showAsk_; | 33 BOOL showAsk_; |
| 34 | 34 |
| 35 // Listens for changes to the content settings and reloads the data when they | 35 // Listens for changes to the content settings and reloads the data when they |
| 36 // change. See comment in -modelDidChange in the mm file for details. | 36 // change. See comment in -modelDidChange in the mm file for details. |
| 37 scoped_ptr<UpdatingContentSettingsObserver> tableObserver_; | 37 scoped_ptr<ContentExceptionsTableModelObserver> tableObserver_; |
| 38 | 38 |
| 39 // If this is set to NO, notifications by |tableObserver_| are ignored. This | 39 // If this is set to NO, notifications by |tableObserver_| are ignored. This |
| 40 // is used to suppress updates at bad times. | 40 // is used to suppress updates at bad times. |
| 41 BOOL updatesEnabled_; | 41 BOOL updatesEnabled_; |
| 42 | 42 |
| 43 // This is non-NULL only while a new element is being added and its host | 43 // This is non-NULL only while a new element is being added and its host |
| 44 // is being edited. | 44 // is being edited. |
| 45 scoped_ptr<HostContentSettingsMap::HostSettingPair> newException_; | 45 scoped_ptr<HostContentSettingsMap::HostSettingPair> newException_; |
| 46 } | 46 } |
| 47 | 47 |
| 48 // Shows or makes frontmost the content exceptions window for |settingsType|. | 48 // Shows or makes frontmost the content exceptions window for |settingsType|. |
| 49 // Changes made by the user in the window are persisted in |settingsMap|. | 49 // Changes made by the user in the window are persisted in |settingsMap|. |
| 50 + (id)showForType:(ContentSettingsType)settingsType | 50 + (id)showForType:(ContentSettingsType)settingsType |
| 51 settingsMap:(HostContentSettingsMap*)settingsMap; | 51 settingsMap:(HostContentSettingsMap*)settingsMap; |
| 52 | 52 |
| 53 - (IBAction)addException:(id)sender; | 53 - (IBAction)addException:(id)sender; |
| 54 - (IBAction)removeException:(id)sender; | 54 - (IBAction)removeException:(id)sender; |
| 55 - (IBAction)removeAllExceptions:(id)sender; | 55 - (IBAction)removeAllExceptions:(id)sender; |
| 56 | 56 |
| 57 @end | 57 @end |
| 58 | 58 |
| 59 @interface ContentExceptionsWindowController(VisibleForTesting) | 59 @interface ContentExceptionsWindowController(VisibleForTesting) |
| 60 - (void)cancel:(id)sender; | 60 - (void)cancel:(id)sender; |
| 61 - (BOOL)editingNewException; | 61 - (BOOL)editingNewException; |
| 62 @end | 62 @end |
| OLD | NEW |