summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/content_settings_dialog_controller.mm
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-26 21:44:17 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-26 21:44:17 +0000
commit68828be583862a07c72c3c223a6309b8fb708051 (patch)
tree3811e7d760f47da93cc21bcc06b374225716f3ab /chrome/browser/cocoa/content_settings_dialog_controller.mm
parent90ef2e048af8572f9b8dbac6d8385b7c70bb80b7 (diff)
downloadchromium_src-68828be583862a07c72c3c223a6309b8fb708051.zip
chromium_src-68828be583862a07c72c3c223a6309b8fb708051.tar.gz
chromium_src-68828be583862a07c72c3c223a6309b8fb708051.tar.bz2
Mac: Add geolocation content setting.
The radio button seems to be non-functional; probably the backend probably isn't there yet. xib changes: Added a location tab to contentsettings.xib, bind its radio buttons and normal button to the new methods in the controller. In the bubble, enable the "settings" button. BUG=11246 TEST=content settings now has a "location" tab. Review URL: http://codereview.chromium.org/1428002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42827 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/content_settings_dialog_controller.mm')
-rw-r--r--chrome/browser/cocoa/content_settings_dialog_controller.mm39
1 files changed, 39 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/content_settings_dialog_controller.mm b/chrome/browser/cocoa/content_settings_dialog_controller.mm
index ef66d7d..a23ea9b 100644
--- a/chrome/browser/cocoa/content_settings_dialog_controller.mm
+++ b/chrome/browser/cocoa/content_settings_dialog_controller.mm
@@ -12,6 +12,7 @@
#include "chrome/browser/browser_window.h"
#import "chrome/browser/cocoa/content_exceptions_window_controller.h"
#import "chrome/browser/cocoa/cookies_window_controller.h"
+#import "chrome/browser/geolocation/geolocation_content_settings_map.h"
#import "chrome/browser/host_content_settings_map.h"
#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
@@ -36,6 +37,11 @@ const NSInteger kCookieDisabledIndex = 2;
// Stores the currently visible content settings dialog, if any.
ContentSettingsDialogController* g_instance = nil;
+// Indices of the various geolocation settings in the geolocation radio group.
+const NSInteger kGeolocationEnabledIndex = 0;
+const NSInteger kGeolocationAskIndex = 1;
+const NSInteger kGeolocationDisabledIndex = 2;
+
} // namespace
@@ -52,6 +58,8 @@ ContentSettingsDialogController* g_instance = nil;
@property(assign, nonatomic) NSInteger javaScriptEnabledIndex;
@property(assign, nonatomic) NSInteger popupsEnabledIndex;
@property(assign, nonatomic) NSInteger pluginsEnabledIndex;
+@property(assign, nonatomic) NSInteger geolocationSettingIndex;
+
@end
namespace ContentSettingsDialogControllerInternal {
@@ -258,6 +266,11 @@ class PrefObserverBridge : public NotificationObserver {
[self showExceptionsForType:CONTENT_SETTINGS_TYPE_POPUPS];
}
+- (IBAction)showGeolocationExceptions:(id)sender {
+ // TODO(thakis): Implement.
+ NOTIMPLEMENTED();
+}
+
- (void)showExceptionsForType:(ContentSettingsType)settingsType {
HostContentSettingsMap* settingsMap = profile_->GetHostContentSettingsMap();
[ContentExceptionsWindowController showForType:settingsType
@@ -324,4 +337,30 @@ class PrefObserverBridge : public NotificationObserver {
return enabled ? kEnabledIndex : kDisabledIndex;
}
+- (void)setGeolocationSettingIndex:(NSInteger)value {
+ ContentSetting setting = CONTENT_SETTING_DEFAULT;
+ switch (value) {
+ case kGeolocationEnabledIndex: setting = CONTENT_SETTING_ALLOW; break;
+ case kGeolocationAskIndex: setting = CONTENT_SETTING_ASK; break;
+ case kGeolocationDisabledIndex: setting = CONTENT_SETTING_BLOCK; break;
+ default:
+ NOTREACHED();
+ }
+ profile_->GetGeolocationContentSettingsMap()->SetDefaultContentSetting(
+ setting);
+}
+
+- (NSInteger)geolocationSettingIndex {
+ ContentSetting setting =
+ profile_->GetGeolocationContentSettingsMap()->GetDefaultContentSetting();
+ switch (setting) {
+ case CONTENT_SETTING_ALLOW: return kGeolocationEnabledIndex;
+ case CONTENT_SETTING_ASK: return kGeolocationAskIndex;
+ case CONTENT_SETTING_BLOCK: return kGeolocationDisabledIndex;
+ default:
+ NOTREACHED();
+ return kGeolocationAskIndex;
+ }
+}
+
@end