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

Side by Side Diff: chrome/browser/cocoa/content_settings_dialog_controller.mm

Issue 2963006: Remove the cookie prompt from the settings UI and migrate prefs from ask to block. (Closed)
Patch Set: updates Created 10 years, 5 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 "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/mac_util.h" 10 #include "base/mac_util.h"
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 227
228 // Let esc close the window. 228 // Let esc close the window.
229 - (void)cancel:(id)sender { 229 - (void)cancel:(id)sender {
230 [self close]; 230 [self close];
231 } 231 }
232 232
233 - (void)setCookieSettingIndex:(NSInteger)value { 233 - (void)setCookieSettingIndex:(NSInteger)value {
234 ContentSetting setting = CONTENT_SETTING_DEFAULT; 234 ContentSetting setting = CONTENT_SETTING_DEFAULT;
235 switch (value) { 235 switch (value) {
236 case kCookieEnabledIndex: setting = CONTENT_SETTING_ALLOW; break; 236 case kCookieEnabledIndex: setting = CONTENT_SETTING_ALLOW; break;
237 case kCookieAskIndex: setting = CONTENT_SETTING_ASK; break;
238 case kCookieDisabledIndex: setting = CONTENT_SETTING_BLOCK; break; 237 case kCookieDisabledIndex: setting = CONTENT_SETTING_BLOCK; break;
239 default: 238 default:
240 NOTREACHED(); 239 NOTREACHED();
241 } 240 }
242 ContentSettingsDialogControllerInternal::PrefObserverDisabler 241 ContentSettingsDialogControllerInternal::PrefObserverDisabler
243 disabler(observer_.get()); 242 disabler(observer_.get());
244 profile_->GetHostContentSettingsMap()->SetDefaultContentSetting( 243 profile_->GetHostContentSettingsMap()->SetDefaultContentSetting(
245 CONTENT_SETTINGS_TYPE_COOKIES, 244 CONTENT_SETTINGS_TYPE_COOKIES,
246 setting); 245 setting);
247 } 246 }
248 247
249 - (NSInteger)cookieSettingIndex { 248 - (NSInteger)cookieSettingIndex {
250 switch (profile_->GetHostContentSettingsMap()->GetDefaultContentSetting( 249 switch (profile_->GetHostContentSettingsMap()->GetDefaultContentSetting(
251 CONTENT_SETTINGS_TYPE_COOKIES)) { 250 CONTENT_SETTINGS_TYPE_COOKIES)) {
252 case CONTENT_SETTING_ALLOW: return kCookieEnabledIndex; 251 case CONTENT_SETTING_ALLOW: return kCookieEnabledIndex;
253 case CONTENT_SETTING_ASK: return kCookieAskIndex; 252 case CONTENT_SETTING_BLOCK: return kCookieDisabledIndex;
254 case CONTENT_SETTING_BLOCK: return kCookieDisabledIndex;
255 default: 253 default:
256 NOTREACHED(); 254 NOTREACHED();
257 return kCookieEnabledIndex; 255 return kCookieEnabledIndex;
258 } 256 }
259 } 257 }
260 258
261 - (BOOL)blockThirdPartyCookies { 259 - (BOOL)blockThirdPartyCookies {
262 HostContentSettingsMap* settingsMap = profile_->GetHostContentSettingsMap(); 260 HostContentSettingsMap* settingsMap = profile_->GetHostContentSettingsMap();
263 return settingsMap->BlockThirdPartyCookies(); 261 return settingsMap->BlockThirdPartyCookies();
264 } 262 }
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 [self willChangeValueForKey:@"geolocationSettingIndex"]; 517 [self willChangeValueForKey:@"geolocationSettingIndex"];
520 [self didChangeValueForKey:@"geolocationSettingIndex"]; 518 [self didChangeValueForKey:@"geolocationSettingIndex"];
521 } 519 }
522 if (*prefName == prefs::kDesktopNotificationDefaultContentSetting) { 520 if (*prefName == prefs::kDesktopNotificationDefaultContentSetting) {
523 [self willChangeValueForKey:@"notificationsSettingIndex"]; 521 [self willChangeValueForKey:@"notificationsSettingIndex"];
524 [self didChangeValueForKey:@"notificationsSettingIndex"]; 522 [self didChangeValueForKey:@"notificationsSettingIndex"];
525 } 523 }
526 } 524 }
527 525
528 @end 526 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698