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

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

Issue 600133: Mac: Content blocked icons. (Closed)
Patch Set: comments andybons Created 10 years, 10 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
« no previous file with comments | « chrome/browser/cocoa/location_bar_view_mac.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/preferences_window_controller.h" 5 #import "chrome/browser/cocoa/preferences_window_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include "app/l10n_util.h" 8 #include "app/l10n_util.h"
9 #include "app/l10n_util_mac.h" 9 #include "app/l10n_util_mac.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 14 matching lines...) Expand all
25 #import "chrome/browser/cocoa/import_settings_dialog.h" 25 #import "chrome/browser/cocoa/import_settings_dialog.h"
26 #import "chrome/browser/cocoa/keyword_editor_cocoa_controller.h" 26 #import "chrome/browser/cocoa/keyword_editor_cocoa_controller.h"
27 #import "chrome/browser/cocoa/search_engine_list_model.h" 27 #import "chrome/browser/cocoa/search_engine_list_model.h"
28 #include "chrome/browser/extensions/extensions_service.h" 28 #include "chrome/browser/extensions/extensions_service.h"
29 #include "chrome/browser/metrics/metrics_service.h" 29 #include "chrome/browser/metrics/metrics_service.h"
30 #include "chrome/browser/metrics/user_metrics.h" 30 #include "chrome/browser/metrics/user_metrics.h"
31 #include "chrome/browser/net/dns_global.h" 31 #include "chrome/browser/net/dns_global.h"
32 #include "chrome/browser/net/url_fixer_upper.h" 32 #include "chrome/browser/net/url_fixer_upper.h"
33 #include "chrome/browser/options_window.h" 33 #include "chrome/browser/options_window.h"
34 #include "chrome/browser/profile.h" 34 #include "chrome/browser/profile.h"
35 #include "chrome/browser/host_content_settings_map.h"
35 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 36 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
36 #include "chrome/browser/session_startup_pref.h" 37 #include "chrome/browser/session_startup_pref.h"
37 #include "chrome/browser/shell_integration.h" 38 #include "chrome/browser/shell_integration.h"
38 #include "chrome/browser/sync/profile_sync_service.h" 39 #include "chrome/browser/sync/profile_sync_service.h"
39 #include "chrome/browser/sync/sync_ui_util.h" 40 #include "chrome/browser/sync/sync_ui_util.h"
40 #include "chrome/browser/tab_contents/tab_contents.h" 41 #include "chrome/browser/tab_contents/tab_contents.h"
41 #include "chrome/common/notification_details.h" 42 #include "chrome/common/notification_details.h"
42 #include "chrome/common/notification_observer.h" 43 #include "chrome/common/notification_observer.h"
43 #include "chrome/common/notification_type.h" 44 #include "chrome/common/notification_type.h"
44 #include "chrome/common/pref_names.h" 45 #include "chrome/common/pref_names.h"
(...skipping 1370 matching lines...) Expand 10 before | Expand all | Expand 10 after
1415 // displayed based on |value|. 1416 // displayed based on |value|.
1416 - (void)setDnsPrefetch:(BOOL)value { 1417 - (void)setDnsPrefetch:(BOOL)value {
1417 if (value) 1418 if (value)
1418 [self recordUserAction:"Options_DnsPrefetchCheckbox_Enable"]; 1419 [self recordUserAction:"Options_DnsPrefetchCheckbox_Enable"];
1419 else 1420 else
1420 [self recordUserAction:"Options_DnsPrefetchCheckbox_Disable"]; 1421 [self recordUserAction:"Options_DnsPrefetchCheckbox_Disable"];
1421 dnsPrefetch_.SetValue(value ? true : false); 1422 dnsPrefetch_.SetValue(value ? true : false);
1422 chrome_browser_net::EnableDnsPrefetch(value ? true : false); 1423 chrome_browser_net::EnableDnsPrefetch(value ? true : false);
1423 } 1424 }
1424 1425
1426 - (BOOL)blockImages {
1427 return profile_->GetHostContentSettingsMap()->GetDefaultContentSetting(
1428 CONTENT_SETTINGS_TYPE_IMAGES) != CONTENT_SETTING_ALLOW;
1429 }
1430
1431 - (void)setBlockImages:(BOOL)value {
1432 // profile_->GetHostContentSettingsMap()->SetDefaultContentSetting(
1433 // content_type_,
1434 // CONTENT_SETTINGS_TYPE_IMAGES,
1435 // value ? CONTENT_SETTING_BLOCK : CONTENT_SETTING_ALLOW);
1436 profile_->GetHostContentSettingsMap()->SetDefaultContentSetting(
1437 CONTENT_SETTINGS_TYPE_IMAGES,
1438 value ? CONTENT_SETTING_BLOCK : CONTENT_SETTING_ALLOW);
1439 // profile_->GetHostContentSettingsMap()->SetDefaultContentSetting(
1440 // CONTENT_SETTINGS_TYPE_PLUGINS,
1441 // value ? CONTENT_SETTING_BLOCK : CONTENT_SETTING_ALLOW);
1442
1443 // blockImages_.SetValue(value ? true : false);
1444 }
1445
1446 - (BOOL)blockJavaScript {
1447 return profile_->GetHostContentSettingsMap()->GetDefaultContentSetting(
1448 CONTENT_SETTINGS_TYPE_JAVASCRIPT) != CONTENT_SETTING_ALLOW;
1449 }
1450
1451 - (void)setBlockJavaScript:(BOOL)value {
1452 profile_->GetHostContentSettingsMap()->SetDefaultContentSetting(
1453 CONTENT_SETTINGS_TYPE_JAVASCRIPT,
1454 value ? CONTENT_SETTING_BLOCK : CONTENT_SETTING_ALLOW);
1455 }
1456
1457
1425 // Returns whether the safe browsing checkbox should be checked based on the 1458 // Returns whether the safe browsing checkbox should be checked based on the
1426 // preference. 1459 // preference.
1427 - (BOOL)safeBrowsing { 1460 - (BOOL)safeBrowsing {
1428 return safeBrowsing_.GetValue() ? YES : NO; 1461 return safeBrowsing_.GetValue() ? YES : NO;
1429 } 1462 }
1430 1463
1431 // Sets the backend pref for whether or not the safe browsing checkbox should be 1464 // Sets the backend pref for whether or not the safe browsing checkbox should be
1432 // displayed based on |value|. 1465 // displayed based on |value|.
1433 - (void)setSafeBrowsing:(BOOL)value { 1466 - (void)setSafeBrowsing:(BOOL)value {
1434 if (value) 1467 if (value)
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
1820 case OPTIONS_PAGE_ADVANCED: 1853 case OPTIONS_PAGE_ADVANCED:
1821 return underTheHoodView_; 1854 return underTheHoodView_;
1822 case OPTIONS_PAGE_DEFAULT: 1855 case OPTIONS_PAGE_DEFAULT:
1823 case OPTIONS_PAGE_COUNT: 1856 case OPTIONS_PAGE_COUNT:
1824 LOG(DFATAL) << "Invalid page value " << page; 1857 LOG(DFATAL) << "Invalid page value " << page;
1825 } 1858 }
1826 return basicsView_; 1859 return basicsView_;
1827 } 1860 }
1828 1861
1829 @end 1862 @end
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/location_bar_view_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698