| 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 "chrome/browser/cocoa/content_settings_dialog_controller.h" | 5 #import "chrome/browser/cocoa/content_settings_dialog_controller.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 profile_ = profile; | 133 profile_ = profile; |
| 134 | 134 |
| 135 observer_.reset( | 135 observer_.reset( |
| 136 new ContentSettingsDialogControllerInternal::PrefObserverBridge(self)); | 136 new ContentSettingsDialogControllerInternal::PrefObserverBridge(self)); |
| 137 clearSiteDataOnExit_.Init(prefs::kClearSiteDataOnExit, | 137 clearSiteDataOnExit_.Init(prefs::kClearSiteDataOnExit, |
| 138 profile_->GetPrefs(), observer_.get()); | 138 profile_->GetPrefs(), observer_.get()); |
| 139 | 139 |
| 140 // Manually observe notifications for preferences that are grouped in | 140 // Manually observe notifications for preferences that are grouped in |
| 141 // the HostContentSettingsMap or GeolocationContentSettingsMap. | 141 // the HostContentSettingsMap or GeolocationContentSettingsMap. |
| 142 PrefService* prefs = profile_->GetPrefs(); | 142 PrefService* prefs = profile_->GetPrefs(); |
| 143 prefs->AddPrefObserver(prefs::kBlockThirdPartyCookies, observer_.get()); | 143 registrar_.Init(prefs); |
| 144 prefs->AddPrefObserver(prefs::kBlockNonsandboxedPlugins, observer_.get()); | 144 registrar_.Add(prefs::kBlockThirdPartyCookies, observer_.get()); |
| 145 prefs->AddPrefObserver(prefs::kDefaultContentSettings, observer_.get()); | 145 registrar_.Add(prefs::kBlockNonsandboxedPlugins, observer_.get()); |
| 146 prefs->AddPrefObserver(prefs::kGeolocationDefaultContentSetting, | 146 registrar_.Add(prefs::kDefaultContentSettings, observer_.get()); |
| 147 observer_.get()); | 147 registrar_.Add(prefs::kGeolocationDefaultContentSetting, observer_.get()); |
| 148 | 148 |
| 149 // We don't need to observe changes in this value. | 149 // We don't need to observe changes in this value. |
| 150 lastSelectedTab_.Init(prefs::kContentSettingsWindowLastTabIndex, | 150 lastSelectedTab_.Init(prefs::kContentSettingsWindowLastTabIndex, |
| 151 profile_->GetPrefs(), NULL); | 151 profile_->GetPrefs(), NULL); |
| 152 } | 152 } |
| 153 return self; | 153 return self; |
| 154 } | 154 } |
| 155 | 155 |
| 156 - (void)dealloc { | |
| 157 if (profile_) { | |
| 158 PrefService* prefs = profile_->GetPrefs(); | |
| 159 prefs->RemovePrefObserver(prefs::kBlockThirdPartyCookies, observer_.get()); | |
| 160 prefs->RemovePrefObserver(prefs::kBlockNonsandboxedPlugins, | |
| 161 observer_.get()); | |
| 162 prefs->RemovePrefObserver(prefs::kDefaultContentSettings, observer_.get()); | |
| 163 prefs->RemovePrefObserver(prefs::kGeolocationDefaultContentSetting, | |
| 164 observer_.get()); | |
| 165 } | |
| 166 | |
| 167 [super dealloc]; | |
| 168 } | |
| 169 | |
| 170 - (void)closeExceptionsSheet { | 156 - (void)closeExceptionsSheet { |
| 171 NSWindow* attachedSheet = [[self window] attachedSheet]; | 157 NSWindow* attachedSheet = [[self window] attachedSheet]; |
| 172 if (attachedSheet) { | 158 if (attachedSheet) { |
| 173 [NSApp endSheet:attachedSheet]; | 159 [NSApp endSheet:attachedSheet]; |
| 174 } | 160 } |
| 175 } | 161 } |
| 176 | 162 |
| 177 - (void)awakeFromNib { | 163 - (void)awakeFromNib { |
| 178 DCHECK([self window]); | 164 DCHECK([self window]); |
| 179 DCHECK(tabView_); | 165 DCHECK(tabView_); |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 [self willChangeValueForKey:@"geolocationSettingIndex"]; | 549 [self willChangeValueForKey:@"geolocationSettingIndex"]; |
| 564 [self didChangeValueForKey:@"geolocationSettingIndex"]; | 550 [self didChangeValueForKey:@"geolocationSettingIndex"]; |
| 565 } | 551 } |
| 566 if (*prefName == prefs::kDesktopNotificationDefaultContentSetting) { | 552 if (*prefName == prefs::kDesktopNotificationDefaultContentSetting) { |
| 567 [self willChangeValueForKey:@"notificationsSettingIndex"]; | 553 [self willChangeValueForKey:@"notificationsSettingIndex"]; |
| 568 [self didChangeValueForKey:@"notificationsSettingIndex"]; | 554 [self didChangeValueForKey:@"notificationsSettingIndex"]; |
| 569 } | 555 } |
| 570 } | 556 } |
| 571 | 557 |
| 572 @end | 558 @end |
| OLD | NEW |