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

Unified Diff: chrome/browser/cocoa/content_settings_dialog_controller.mm

Issue 1428002: Mac: Add geolocation content setting. (Closed)
Patch Set: Created 10 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/cocoa/content_settings_dialog_controller.mm
diff --git a/chrome/browser/cocoa/content_settings_dialog_controller.mm b/chrome/browser/cocoa/content_settings_dialog_controller.mm
index ef66d7d68f4438a6a7d58e352478c2b020a19431..a23ea9b1ff6e6d8d3fff2fca58187754b89fb051 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:
viettrungluu 2010/03/26 20:50:18 Is ContentSetting an enum? Does the compiler warn
Nico 2010/03/26 20:54:10 Yes.
+ NOTREACHED();
+ return kGeolocationAskIndex;
+ }
+}
+
@end

Powered by Google App Engine
This is Rietveld 408576698