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

Side by Side Diff: chrome/browser/gtk/options/advanced_contents_gtk.cc

Issue 556095: Changes to support new cookie policy.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #include "chrome/browser/gtk/options/advanced_contents_gtk.h" 5 #include "chrome/browser/gtk/options/advanced_contents_gtk.h"
6 6
7 #include <sys/types.h> 7 #include <sys/types.h>
8 #include <sys/wait.h> 8 #include <sys/wait.h>
9 9
10 #include "app/l10n_util.h" 10 #include "app/l10n_util.h"
(...skipping 18 matching lines...) Expand all
29 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" 29 #include "chrome/browser/renderer_host/resource_dispatcher_host.h"
30 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 30 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
31 #include "chrome/common/chrome_paths.h" 31 #include "chrome/common/chrome_paths.h"
32 #include "chrome/common/gtk_util.h" 32 #include "chrome/common/gtk_util.h"
33 #include "chrome/common/pref_member.h" 33 #include "chrome/common/pref_member.h"
34 #include "chrome/common/pref_names.h" 34 #include "chrome/common/pref_names.h"
35 #include "chrome/common/process_watcher.h" 35 #include "chrome/common/process_watcher.h"
36 #include "grit/chromium_strings.h" 36 #include "grit/chromium_strings.h"
37 #include "grit/generated_resources.h" 37 #include "grit/generated_resources.h"
38 #include "grit/locale_settings.h" 38 #include "grit/locale_settings.h"
39 #include "net/base/cookie_policy.h"
40 39
41 namespace { 40 namespace {
42 41
43 // Command used to configure GNOME proxy settings. The command was renamed 42 // Command used to configure GNOME proxy settings. The command was renamed
44 // in January 2009, so both are used to work on both old and new systems. 43 // in January 2009, so both are used to work on both old and new systems.
45 const char* kOldGNOMEProxyConfigCommand[] = {"gnome-network-preferences", NULL}; 44 const char* kOldGNOMEProxyConfigCommand[] = {"gnome-network-preferences", NULL};
46 const char* kGNOMEProxyConfigCommand[] = {"gnome-network-properties", NULL}; 45 const char* kGNOMEProxyConfigCommand[] = {"gnome-network-properties", NULL};
47 // KDE3 and KDE4 are only slightly different, but incompatible. Go figure. 46 // KDE3 and KDE4 are only slightly different, but incompatible. Go figure.
48 const char* kKDE3ProxyConfigCommand[] = {"kcmshell", "proxy", NULL}; 47 const char* kKDE3ProxyConfigCommand[] = {"kcmshell", "proxy", NULL};
49 const char* kKDE4ProxyConfigCommand[] = {"kcmshell4", "proxy", NULL}; 48 const char* kKDE4ProxyConfigCommand[] = {"kcmshell4", "proxy", NULL};
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 GtkWidget* reporting_enabled_checkbox_; 524 GtkWidget* reporting_enabled_checkbox_;
526 #endif 525 #endif
527 GtkWidget* cookie_behavior_combobox_; 526 GtkWidget* cookie_behavior_combobox_;
528 527
529 // Preferences for this section: 528 // Preferences for this section:
530 BooleanPrefMember alternate_error_pages_; 529 BooleanPrefMember alternate_error_pages_;
531 BooleanPrefMember use_suggest_; 530 BooleanPrefMember use_suggest_;
532 BooleanPrefMember dns_prefetch_enabled_; 531 BooleanPrefMember dns_prefetch_enabled_;
533 BooleanPrefMember safe_browsing_; 532 BooleanPrefMember safe_browsing_;
534 BooleanPrefMember enable_metrics_recording_; 533 BooleanPrefMember enable_metrics_recording_;
535 IntegerPrefMember cookie_behavior_;
536 534
537 // Flag to ignore gtk callbacks while we are loading prefs, to avoid 535 // Flag to ignore gtk callbacks while we are loading prefs, to avoid
538 // then turning around and saving them again. 536 // then turning around and saving them again.
539 bool pref_changing_; 537 bool pref_changing_;
540 538
541 scoped_ptr<AccessibleWidgetHelper> accessible_widget_helper_; 539 scoped_ptr<AccessibleWidgetHelper> accessible_widget_helper_;
542 540
543 DISALLOW_COPY_AND_ASSIGN(PrivacySection); 541 DISALLOW_COPY_AND_ASSIGN(PrivacySection);
544 }; 542 };
545 543
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 // Init member prefs so we can update the controls if prefs change. 657 // Init member prefs so we can update the controls if prefs change.
660 alternate_error_pages_.Init(prefs::kAlternateErrorPagesEnabled, 658 alternate_error_pages_.Init(prefs::kAlternateErrorPagesEnabled,
661 profile->GetPrefs(), this); 659 profile->GetPrefs(), this);
662 use_suggest_.Init(prefs::kSearchSuggestEnabled, 660 use_suggest_.Init(prefs::kSearchSuggestEnabled,
663 profile->GetPrefs(), this); 661 profile->GetPrefs(), this);
664 dns_prefetch_enabled_.Init(prefs::kDnsPrefetchingEnabled, 662 dns_prefetch_enabled_.Init(prefs::kDnsPrefetchingEnabled,
665 profile->GetPrefs(), this); 663 profile->GetPrefs(), this);
666 safe_browsing_.Init(prefs::kSafeBrowsingEnabled, profile->GetPrefs(), this); 664 safe_browsing_.Init(prefs::kSafeBrowsingEnabled, profile->GetPrefs(), this);
667 enable_metrics_recording_.Init(prefs::kMetricsReportingEnabled, 665 enable_metrics_recording_.Init(prefs::kMetricsReportingEnabled,
668 g_browser_process->local_state(), this); 666 g_browser_process->local_state(), this);
669 cookie_behavior_.Init(prefs::kCookieBehavior, profile->GetPrefs(), this);
670 667
671 NotifyPrefChanged(NULL); 668 NotifyPrefChanged(NULL);
672 } 669 }
673 670
674 // static 671 // static
675 void PrivacySection::OnLearnMoreLinkClicked(GtkButton *button, 672 void PrivacySection::OnLearnMoreLinkClicked(GtkButton *button,
676 PrivacySection* privacy_section) { 673 PrivacySection* privacy_section) {
677 BrowserList::GetLastActive()-> 674 BrowserList::GetLastActive()->
678 OpenURL(GURL(l10n_util::GetStringUTF8(IDS_LEARN_MORE_PRIVACY_URL)), 675 OpenURL(GURL(l10n_util::GetStringUTF8(IDS_LEARN_MORE_PRIVACY_URL)),
679 GURL(), NEW_WINDOW, PageTransition::LINK); 676 GURL(), NEW_WINDOW, PageTransition::LINK);
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 privacy_section->ShowRestartMessageBox(); 758 privacy_section->ShowRestartMessageBox();
762 g_signal_handlers_unblock_by_func(widget, 759 g_signal_handlers_unblock_by_func(widget,
763 reinterpret_cast<gpointer>(OnLoggingChange), 760 reinterpret_cast<gpointer>(OnLoggingChange),
764 privacy_section); 761 privacy_section);
765 privacy_section->enable_metrics_recording_.SetValue(enabled); 762 privacy_section->enable_metrics_recording_.SetValue(enabled);
766 } 763 }
767 764
768 // static 765 // static
769 void PrivacySection::OnCookieBehaviorChanged(GtkComboBox* combo_box, 766 void PrivacySection::OnCookieBehaviorChanged(GtkComboBox* combo_box,
770 PrivacySection* privacy_section) { 767 PrivacySection* privacy_section) {
771 if (privacy_section->pref_changing_) 768 // TODO(darin): Remove everything else related to this setter.
772 return;
773 net::CookiePolicy::Type cookie_policy =
774 net::CookiePolicy::FromInt(gtk_combo_box_get_active(combo_box));
775 const char* kUserMetrics[] = {
776 "Options_AllowAllCookies",
777 "Options_BlockThirdPartyCookies",
778 "Options_BlockAllCookies"
779 };
780 if (cookie_policy < 0 ||
781 static_cast<size_t>(cookie_policy) >= arraysize(kUserMetrics)) {
782 NOTREACHED();
783 return;
784 }
785 privacy_section->UserMetricsRecordAction(
786 kUserMetrics[cookie_policy], privacy_section->profile()->GetPrefs());
787 privacy_section->cookie_behavior_.SetValue(cookie_policy);
788 } 769 }
789 770
790 // static 771 // static
791 void PrivacySection::OnShowCookiesButtonClicked( 772 void PrivacySection::OnShowCookiesButtonClicked(
792 GtkButton *button, PrivacySection* privacy_section) { 773 GtkButton *button, PrivacySection* privacy_section) {
793 privacy_section->UserMetricsRecordAction("Options_ShowCookies", NULL); 774 privacy_section->UserMetricsRecordAction("Options_ShowCookies", NULL);
794 CookiesView::Show(privacy_section->profile(), 775 CookiesView::Show(privacy_section->profile(),
795 new BrowsingDataLocalStorageHelper( 776 new BrowsingDataLocalStorageHelper(
796 privacy_section->profile())); 777 privacy_section->profile()));
797 } 778 }
(...skipping 20 matching lines...) Expand all
818 GTK_TOGGLE_BUTTON(enable_safe_browsing_checkbox_), 799 GTK_TOGGLE_BUTTON(enable_safe_browsing_checkbox_),
819 safe_browsing_.GetValue()); 800 safe_browsing_.GetValue());
820 } 801 }
821 #if defined(GOOGLE_CHROME_BUILD) 802 #if defined(GOOGLE_CHROME_BUILD)
822 if (!pref_name || *pref_name == prefs::kMetricsReportingEnabled) { 803 if (!pref_name || *pref_name == prefs::kMetricsReportingEnabled) {
823 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(reporting_enabled_checkbox_), 804 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(reporting_enabled_checkbox_),
824 enable_metrics_recording_.GetValue()); 805 enable_metrics_recording_.GetValue());
825 ResolveMetricsReportingEnabled(); 806 ResolveMetricsReportingEnabled();
826 } 807 }
827 #endif 808 #endif
828 if (!pref_name || *pref_name == prefs::kCookieBehavior) {
829 gtk_combo_box_set_active(
830 GTK_COMBO_BOX(cookie_behavior_combobox_),
831 net::CookiePolicy::FromInt(cookie_behavior_.GetValue()));
832 }
833 pref_changing_ = false; 809 pref_changing_ = false;
834 } 810 }
835 811
836 void PrivacySection::ResolveMetricsReportingEnabled() { 812 void PrivacySection::ResolveMetricsReportingEnabled() {
837 #if defined(GOOGLE_CHROME_BUILD) 813 #if defined(GOOGLE_CHROME_BUILD)
838 bool enabled = gtk_toggle_button_get_active( 814 bool enabled = gtk_toggle_button_get_active(
839 GTK_TOGGLE_BUTTON(reporting_enabled_checkbox_)); 815 GTK_TOGGLE_BUTTON(reporting_enabled_checkbox_));
840 816
841 enabled = OptionsUtil::ResolveMetricsReportingEnabled(enabled); 817 enabled = OptionsUtil::ResolveMetricsReportingEnabled(enabled);
842 818
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
1154 l10n_util::GetStringUTF8(IDS_OPTIONS_ADVANCED_SECTION_TITLE_CONTENT), 1130 l10n_util::GetStringUTF8(IDS_OPTIONS_ADVANCED_SECTION_TITLE_CONTENT),
1155 web_content_section_->get_page_widget(), false); 1131 web_content_section_->get_page_widget(), false);
1156 1132
1157 security_section_.reset(new SecuritySection(profile_)); 1133 security_section_.reset(new SecuritySection(profile_));
1158 options_builder.AddOptionGroup( 1134 options_builder.AddOptionGroup(
1159 l10n_util::GetStringUTF8(IDS_OPTIONS_ADVANCED_SECTION_TITLE_SECURITY), 1135 l10n_util::GetStringUTF8(IDS_OPTIONS_ADVANCED_SECTION_TITLE_SECURITY),
1160 security_section_->get_page_widget(), false); 1136 security_section_->get_page_widget(), false);
1161 1137
1162 page_ = options_builder.get_page_widget(); 1138 page_ = options_builder.get_page_widget();
1163 } 1139 }
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/preferences_window_controller.mm ('k') | chrome/browser/host_content_settings_map.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698