Chromium Code Reviews| 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/ui/cocoa/content_settings_dialog_controller.h" | 5 #import "chrome/browser/ui/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 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 549 switch (setting) { | 549 switch (setting) { |
| 550 case CONTENT_SETTING_ALLOW: return kGeolocationEnabledIndex; | 550 case CONTENT_SETTING_ALLOW: return kGeolocationEnabledIndex; |
| 551 case CONTENT_SETTING_ASK: return kGeolocationAskIndex; | 551 case CONTENT_SETTING_ASK: return kGeolocationAskIndex; |
| 552 case CONTENT_SETTING_BLOCK: return kGeolocationDisabledIndex; | 552 case CONTENT_SETTING_BLOCK: return kGeolocationDisabledIndex; |
| 553 default: | 553 default: |
| 554 NOTREACHED(); | 554 NOTREACHED(); |
| 555 return kGeolocationAskIndex; | 555 return kGeolocationAskIndex; |
| 556 } | 556 } |
| 557 } | 557 } |
| 558 | 558 |
| 559 - (BOOL)geolocationSettingsManaged { | |
| 560 return profile_->GetHostContentSettingsMap()->IsDefaultContentSettingManaged( | |
| 561 CONTENT_SETTINGS_TYPE_GEOLOCATION); | |
| 562 } | |
| 563 | |
| 559 - (void)setNotificationsSettingIndex:(NSInteger)value { | 564 - (void)setNotificationsSettingIndex:(NSInteger)value { |
| 560 ContentSetting setting = CONTENT_SETTING_DEFAULT; | 565 ContentSetting setting = CONTENT_SETTING_DEFAULT; |
| 561 switch (value) { | 566 switch (value) { |
| 562 case kNotificationsEnabledIndex: setting = CONTENT_SETTING_ALLOW; break; | 567 case kNotificationsEnabledIndex: setting = CONTENT_SETTING_ALLOW; break; |
| 563 case kNotificationsAskIndex: setting = CONTENT_SETTING_ASK; break; | 568 case kNotificationsAskIndex: setting = CONTENT_SETTING_ASK; break; |
| 564 case kNotificationsDisabledIndex: setting = CONTENT_SETTING_BLOCK; break; | 569 case kNotificationsDisabledIndex: setting = CONTENT_SETTING_BLOCK; break; |
| 565 default: | 570 default: |
| 566 NOTREACHED(); | 571 NOTREACHED(); |
| 567 } | 572 } |
| 568 ContentSettingsDialogControllerInternal::PrefObserverDisabler | 573 ContentSettingsDialogControllerInternal::PrefObserverDisabler |
| 569 disabler(observer_.get()); | 574 disabler(observer_.get()); |
| 570 profile_->GetDesktopNotificationService()->SetDefaultContentSetting( | 575 profile_->GetDesktopNotificationService()->SetDefaultContentSetting( |
| 571 setting); | 576 setting); |
| 572 } | 577 } |
| 573 | 578 |
| 579 - (BOOL)notificationsSettingsManaged { | |
| 580 return profile_->GetHostContentSettingsMap()->IsDefaultContentSettingManaged( | |
| 581 CONTENT_SETTINGS_TYPE_NOTIFICATIONS); | |
| 582 } | |
| 583 | |
| 574 - (NSInteger)notificationsSettingIndex { | 584 - (NSInteger)notificationsSettingIndex { |
| 575 ContentSetting setting = | 585 ContentSetting setting = |
| 576 profile_->GetDesktopNotificationService()->GetDefaultContentSetting(); | 586 profile_->GetDesktopNotificationService()->GetDefaultContentSetting(); |
| 577 switch (setting) { | 587 switch (setting) { |
| 578 case CONTENT_SETTING_ALLOW: return kNotificationsEnabledIndex; | 588 case CONTENT_SETTING_ALLOW: return kNotificationsEnabledIndex; |
| 579 case CONTENT_SETTING_ASK: return kNotificationsAskIndex; | 589 case CONTENT_SETTING_ASK: return kNotificationsAskIndex; |
| 580 case CONTENT_SETTING_BLOCK: return kNotificationsDisabledIndex; | 590 case CONTENT_SETTING_BLOCK: return kNotificationsDisabledIndex; |
| 581 default: | 591 default: |
| 582 NOTREACHED(); | 592 NOTREACHED(); |
| 583 return kGeolocationAskIndex; | 593 return kGeolocationAskIndex; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 624 [self willChangeValueForKey:@"javaScriptSettingsManaged"]; | 634 [self willChangeValueForKey:@"javaScriptSettingsManaged"]; |
| 625 [self didChangeValueForKey:@"javaScriptSettingsManaged"]; | 635 [self didChangeValueForKey:@"javaScriptSettingsManaged"]; |
| 626 [self willChangeValueForKey:@"pluginsSettingsManaged"]; | 636 [self willChangeValueForKey:@"pluginsSettingsManaged"]; |
| 627 [self didChangeValueForKey:@"pluginsSettingsManaged"]; | 637 [self didChangeValueForKey:@"pluginsSettingsManaged"]; |
| 628 [self willChangeValueForKey:@"popupsSettingsManaged"]; | 638 [self willChangeValueForKey:@"popupsSettingsManaged"]; |
| 629 [self didChangeValueForKey:@"popupsSettingsManaged"]; | 639 [self didChangeValueForKey:@"popupsSettingsManaged"]; |
| 630 } | 640 } |
| 631 if (prefName == prefs::kGeolocationDefaultContentSetting) { | 641 if (prefName == prefs::kGeolocationDefaultContentSetting) { |
| 632 [self willChangeValueForKey:@"geolocationSettingIndex"]; | 642 [self willChangeValueForKey:@"geolocationSettingIndex"]; |
| 633 [self didChangeValueForKey:@"geolocationSettingIndex"]; | 643 [self didChangeValueForKey:@"geolocationSettingIndex"]; |
| 644 [self willChangeValueForKey:@"geolocationSettingsManaged"]; | |
| 645 [self didChangeValueForKey:@"geolocationSettinsgManaged"]; | |
| 646 | |
|
Nico
2010/12/16 17:50:35
no newline
| |
| 634 } | 647 } |
| 635 if (prefName == prefs::kDesktopNotificationDefaultContentSetting) { | 648 if (prefName == prefs::kDesktopNotificationDefaultContentSetting) { |
| 636 [self willChangeValueForKey:@"notificationsSettingIndex"]; | 649 [self willChangeValueForKey:@"notificationsSettingIndex"]; |
| 637 [self didChangeValueForKey:@"notificationsSettingIndex"]; | 650 [self didChangeValueForKey:@"notificationsSettingIndex"]; |
| 651 [self willChangeValueForKey:@"notificationsSettingsManaged"]; | |
| 652 [self didChangeValueForKey:@"notificationsSettingsManaged"]; | |
| 638 } | 653 } |
| 639 } | 654 } |
| 640 | 655 |
| 641 - (void)contentSettingsChanged:(ContentSettingsDetails*)details { | 656 - (void)contentSettingsChanged:(ContentSettingsDetails*)details { |
| 642 [self prefChanged:prefs::kBlockNonsandboxedPlugins]; | 657 [self prefChanged:prefs::kBlockNonsandboxedPlugins]; |
| 643 [self prefChanged:prefs::kDefaultContentSettings]; | 658 [self prefChanged:prefs::kDefaultContentSettings]; |
| 644 } | 659 } |
| 645 | 660 |
| 646 @end | 661 @end |
| OLD | NEW |