| 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" |
| 11 #include "base/mac_util.h" | 11 #include "base/mac_util.h" |
| 12 #include "chrome/browser/browser.h" | 12 #include "chrome/browser/browser.h" |
| 13 #include "chrome/browser/browser_window.h" | 13 #include "chrome/browser/browser_window.h" |
| 14 #import "chrome/browser/cocoa/content_exceptions_window_controller.h" | 14 #import "chrome/browser/cocoa/content_exceptions_window_controller.h" |
| 15 #import "chrome/browser/cocoa/cookies_window_controller.h" | 15 #import "chrome/browser/cocoa/cookies_window_controller.h" |
| 16 #import "chrome/browser/cocoa/simple_content_exceptions_window_controller.h" | 16 #import "chrome/browser/cocoa/simple_content_exceptions_window_controller.h" |
| 17 #import "chrome/browser/cocoa/l10n_util.h" | 17 #import "chrome/browser/cocoa/l10n_util.h" |
| 18 #import "chrome/browser/cocoa/tab_view_picker_table.h" | 18 #import "chrome/browser/cocoa/tab_view_picker_table.h" |
| 19 #import "chrome/browser/geolocation/geolocation_content_settings_map.h" | 19 #import "chrome/browser/geolocation/geolocation_content_settings_map.h" |
| 20 #import "chrome/browser/geolocation/geolocation_exceptions_table_model.h" | 20 #import "chrome/browser/geolocation/geolocation_exceptions_table_model.h" |
| 21 #import "chrome/browser/host_content_settings_map.h" | 21 #import "chrome/browser/host_content_settings_map.h" |
| 22 #import "chrome/browser/notifications/desktop_notification_service.h" | 22 #import "chrome/browser/notifications/desktop_notification_service.h" |
| 23 #import "chrome/browser/notifications/notification_exceptions_table_model.h" | 23 #import "chrome/browser/notifications/notification_exceptions_table_model.h" |
| 24 #include "chrome/browser/plugin_exceptions_table_model.h" |
| 24 #include "chrome/browser/prefs/pref_service.h" | 25 #include "chrome/browser/prefs/pref_service.h" |
| 25 #include "chrome/browser/profile.h" | 26 #include "chrome/browser/profile.h" |
| 26 #include "chrome/common/chrome_switches.h" | 27 #include "chrome/common/chrome_switches.h" |
| 27 #include "chrome/common/notification_service.h" | 28 #include "chrome/common/notification_service.h" |
| 28 #include "chrome/common/pref_names.h" | 29 #include "chrome/common/pref_names.h" |
| 29 #include "chrome/common/url_constants.h" | 30 #include "chrome/common/url_constants.h" |
| 30 #include "grit/locale_settings.h" | 31 #include "grit/locale_settings.h" |
| 31 #include "grit/generated_resources.h" | 32 #include "grit/generated_resources.h" |
| 32 | 33 |
| 33 namespace { | 34 namespace { |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 | 338 |
| 338 - (IBAction)showImagesExceptions:(id)sender { | 339 - (IBAction)showImagesExceptions:(id)sender { |
| 339 [self showExceptionsForType:CONTENT_SETTINGS_TYPE_IMAGES]; | 340 [self showExceptionsForType:CONTENT_SETTINGS_TYPE_IMAGES]; |
| 340 } | 341 } |
| 341 | 342 |
| 342 - (IBAction)showJavaScriptExceptions:(id)sender { | 343 - (IBAction)showJavaScriptExceptions:(id)sender { |
| 343 [self showExceptionsForType:CONTENT_SETTINGS_TYPE_JAVASCRIPT]; | 344 [self showExceptionsForType:CONTENT_SETTINGS_TYPE_JAVASCRIPT]; |
| 344 } | 345 } |
| 345 | 346 |
| 346 - (IBAction)showPluginsExceptions:(id)sender { | 347 - (IBAction)showPluginsExceptions:(id)sender { |
| 347 [self showExceptionsForType:CONTENT_SETTINGS_TYPE_PLUGINS]; | 348 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 349 switches::kEnableResourceContentSettings)) { |
| 350 HostContentSettingsMap* settingsMap = profile_->GetHostContentSettingsMap(); |
| 351 HostContentSettingsMap* offTheRecordSettingsMap = |
| 352 profile_->HasOffTheRecordProfile() ? |
| 353 profile_->GetOffTheRecordProfile()->GetHostContentSettingsMap() : |
| 354 NULL; |
| 355 PluginExceptionsTableModel* model = |
| 356 new PluginExceptionsTableModel(settingsMap, offTheRecordSettingsMap); |
| 357 model->LoadSettings(); |
| 358 [[SimpleContentExceptionsWindowController controllerWithTableModel:model] |
| 359 attachSheetTo:[self window]]; |
| 360 } else { |
| 361 [self showExceptionsForType:CONTENT_SETTINGS_TYPE_PLUGINS]; |
| 362 } |
| 348 } | 363 } |
| 349 | 364 |
| 350 - (IBAction)showPopupsExceptions:(id)sender { | 365 - (IBAction)showPopupsExceptions:(id)sender { |
| 351 [self showExceptionsForType:CONTENT_SETTINGS_TYPE_POPUPS]; | 366 [self showExceptionsForType:CONTENT_SETTINGS_TYPE_POPUPS]; |
| 352 } | 367 } |
| 353 | 368 |
| 354 - (IBAction)showGeolocationExceptions:(id)sender { | 369 - (IBAction)showGeolocationExceptions:(id)sender { |
| 355 GeolocationContentSettingsMap* settingsMap = | 370 GeolocationContentSettingsMap* settingsMap = |
| 356 profile_->GetGeolocationContentSettingsMap(); | 371 profile_->GetGeolocationContentSettingsMap(); |
| 357 GeolocationExceptionsTableModel* model = // Freed by window controller. | 372 GeolocationExceptionsTableModel* model = // Freed by window controller. |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 [self willChangeValueForKey:@"geolocationSettingIndex"]; | 575 [self willChangeValueForKey:@"geolocationSettingIndex"]; |
| 561 [self didChangeValueForKey:@"geolocationSettingIndex"]; | 576 [self didChangeValueForKey:@"geolocationSettingIndex"]; |
| 562 } | 577 } |
| 563 if (*prefName == prefs::kDesktopNotificationDefaultContentSetting) { | 578 if (*prefName == prefs::kDesktopNotificationDefaultContentSetting) { |
| 564 [self willChangeValueForKey:@"notificationsSettingIndex"]; | 579 [self willChangeValueForKey:@"notificationsSettingIndex"]; |
| 565 [self didChangeValueForKey:@"notificationsSettingIndex"]; | 580 [self didChangeValueForKey:@"notificationsSettingIndex"]; |
| 566 } | 581 } |
| 567 } | 582 } |
| 568 | 583 |
| 569 @end | 584 @end |
| OLD | NEW |