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

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

Issue 159187: Gtk cookie manager part 1.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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
« no previous file with comments | « chrome/browser/cookies_table_model.cc ('k') | chrome/browser/gtk/options/cookies_view.h » ('j') | 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) 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"
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/linux_util.h" 12 #include "base/linux_util.h"
13 #include "base/path_service.h" 13 #include "base/path_service.h"
14 #include "base/process_util.h" 14 #include "base/process_util.h"
15 #include "chrome/browser/browser_list.h" 15 #include "chrome/browser/browser_list.h"
16 #include "chrome/browser/browser_process.h" 16 #include "chrome/browser/browser_process.h"
17 #include "chrome/browser/download/download_manager.h" 17 #include "chrome/browser/download/download_manager.h"
18 #include "chrome/browser/fonts_languages_window.h" 18 #include "chrome/browser/fonts_languages_window.h"
19 #include "chrome/browser/gtk/gtk_chrome_link_button.h" 19 #include "chrome/browser/gtk/gtk_chrome_link_button.h"
20 #include "chrome/browser/gtk/options/cookies_view.h"
20 #include "chrome/browser/gtk/options/options_layout_gtk.h" 21 #include "chrome/browser/gtk/options/options_layout_gtk.h"
21 #include "chrome/browser/net/dns_global.h" 22 #include "chrome/browser/net/dns_global.h"
22 #include "chrome/browser/options_page_base.h" 23 #include "chrome/browser/options_page_base.h"
23 #include "chrome/browser/options_util.h" 24 #include "chrome/browser/options_util.h"
24 #include "chrome/browser/profile.h" 25 #include "chrome/browser/profile.h"
25 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 26 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
26 #include "chrome/common/chrome_paths.h" 27 #include "chrome/common/chrome_paths.h"
27 #include "chrome/common/gtk_util.h" 28 #include "chrome/common/gtk_util.h"
28 #include "chrome/common/pref_member.h" 29 #include "chrome/common/pref_member.h"
29 #include "chrome/common/pref_names.h" 30 #include "chrome/common/pref_names.h"
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 static void OnEnableSuggestChange(GtkWidget* widget, 354 static void OnEnableSuggestChange(GtkWidget* widget,
354 PrivacySection* options_window); 355 PrivacySection* options_window);
355 static void OnDNSPrefetchingChange(GtkWidget* widget, 356 static void OnDNSPrefetchingChange(GtkWidget* widget,
356 PrivacySection* options_window); 357 PrivacySection* options_window);
357 static void OnSafeBrowsingChange(GtkWidget* widget, 358 static void OnSafeBrowsingChange(GtkWidget* widget,
358 PrivacySection* options_window); 359 PrivacySection* options_window);
359 static void OnLoggingChange(GtkWidget* widget, 360 static void OnLoggingChange(GtkWidget* widget,
360 PrivacySection* options_window); 361 PrivacySection* options_window);
361 static void OnCookieBehaviorChanged(GtkComboBox* combo_box, 362 static void OnCookieBehaviorChanged(GtkComboBox* combo_box,
362 PrivacySection* privacy_section); 363 PrivacySection* privacy_section);
364 static void OnShowCookiesButtonClicked(GtkButton *button,
365 PrivacySection* privacy_section);
363 366
364 // The widget containing the options for this section. 367 // The widget containing the options for this section.
365 GtkWidget* page_; 368 GtkWidget* page_;
366 369
367 // The widgets for the privacy options. 370 // The widgets for the privacy options.
368 GtkWidget* enable_link_doctor_checkbox_; 371 GtkWidget* enable_link_doctor_checkbox_;
369 GtkWidget* enable_suggest_checkbox_; 372 GtkWidget* enable_suggest_checkbox_;
370 GtkWidget* enable_dns_prefetching_checkbox_; 373 GtkWidget* enable_dns_prefetching_checkbox_;
371 GtkWidget* enable_safe_browsing_checkbox_; 374 GtkWidget* enable_safe_browsing_checkbox_;
372 #if defined(GOOGLE_CHROME_BUILD) 375 #if defined(GOOGLE_CHROME_BUILD)
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 444
442 #if defined(GOOGLE_CHROME_BUILD) 445 #if defined(GOOGLE_CHROME_BUILD)
443 reporting_enabled_checkbox_ = CreateCheckButtonWithWrappedLabel( 446 reporting_enabled_checkbox_ = CreateCheckButtonWithWrappedLabel(
444 IDS_OPTIONS_ENABLE_LOGGING); 447 IDS_OPTIONS_ENABLE_LOGGING);
445 gtk_box_pack_start(GTK_BOX(page_), reporting_enabled_checkbox_, 448 gtk_box_pack_start(GTK_BOX(page_), reporting_enabled_checkbox_,
446 FALSE, FALSE, 0); 449 FALSE, FALSE, 0);
447 g_signal_connect(reporting_enabled_checkbox_, "clicked", 450 g_signal_connect(reporting_enabled_checkbox_, "clicked",
448 G_CALLBACK(OnLoggingChange), this); 451 G_CALLBACK(OnLoggingChange), this);
449 #endif 452 #endif
450 453
454 GtkWidget* cookie_description_label = gtk_label_new(
455 l10n_util::GetStringUTF8(IDS_OPTIONS_COOKIES_ACCEPT_LABEL).c_str());
456 gtk_misc_set_alignment(GTK_MISC(cookie_description_label), 0, 0);
457 gtk_box_pack_start(GTK_BOX(page_), cookie_description_label, FALSE, FALSE, 0);
458
459 GtkWidget* cookie_controls = gtk_vbox_new(FALSE, gtk_util::kControlSpacing);
460 gtk_box_pack_start(GTK_BOX(page_),
461 OptionsLayoutBuilderGtk::IndentWidget(cookie_controls),
462 FALSE, FALSE, 0);
463
451 cookie_behavior_combobox_ = gtk_combo_box_new_text(); 464 cookie_behavior_combobox_ = gtk_combo_box_new_text();
452 gtk_combo_box_append_text( 465 gtk_combo_box_append_text(
453 GTK_COMBO_BOX(cookie_behavior_combobox_), 466 GTK_COMBO_BOX(cookie_behavior_combobox_),
454 l10n_util::GetStringUTF8(IDS_OPTIONS_COOKIES_ACCEPT_ALL_COOKIES).c_str()); 467 l10n_util::GetStringUTF8(IDS_OPTIONS_COOKIES_ACCEPT_ALL_COOKIES).c_str());
455 gtk_combo_box_append_text( 468 gtk_combo_box_append_text(
456 GTK_COMBO_BOX(cookie_behavior_combobox_), 469 GTK_COMBO_BOX(cookie_behavior_combobox_),
457 l10n_util::GetStringUTF8( 470 l10n_util::GetStringUTF8(
458 IDS_OPTIONS_COOKIES_RESTRICT_THIRD_PARTY_COOKIES).c_str()); 471 IDS_OPTIONS_COOKIES_RESTRICT_THIRD_PARTY_COOKIES).c_str());
459 gtk_combo_box_append_text( 472 gtk_combo_box_append_text(
460 GTK_COMBO_BOX(cookie_behavior_combobox_), 473 GTK_COMBO_BOX(cookie_behavior_combobox_),
461 l10n_util::GetStringUTF8(IDS_OPTIONS_COOKIES_BLOCK_ALL_COOKIES).c_str()); 474 l10n_util::GetStringUTF8(IDS_OPTIONS_COOKIES_BLOCK_ALL_COOKIES).c_str());
462 g_signal_connect(G_OBJECT(cookie_behavior_combobox_), "changed", 475 g_signal_connect(G_OBJECT(cookie_behavior_combobox_), "changed",
463 G_CALLBACK(OnCookieBehaviorChanged), this); 476 G_CALLBACK(OnCookieBehaviorChanged), this);
477 gtk_box_pack_start(GTK_BOX(cookie_controls), cookie_behavior_combobox_,
478 FALSE, FALSE, 0);
464 479
465 GtkWidget* cookie_controls = gtk_util::CreateLabeledControlsGroup(NULL, 480 GtkWidget* show_cookies_button = gtk_button_new_with_label(
466 l10n_util::GetStringUTF8(IDS_OPTIONS_COOKIES_ACCEPT_LABEL).c_str(), 481 l10n_util::GetStringUTF8(IDS_OPTIONS_COOKIES_SHOWCOOKIES).c_str());
467 cookie_behavior_combobox_, 482 g_signal_connect(show_cookies_button, "clicked",
468 NULL); 483 G_CALLBACK(OnShowCookiesButtonClicked), this);
469 gtk_box_pack_start(GTK_BOX(page_), cookie_controls, FALSE, FALSE, 0); 484 // Stick it in an hbox so it doesn't expand to the whole width.
470 485 GtkWidget* button_hbox = gtk_hbox_new(FALSE, 0);
471 // TODO(mattm): show cookies button 486 gtk_box_pack_start(GTK_BOX(button_hbox), show_cookies_button,
472 gtk_box_pack_start(GTK_BOX(page_),
473 gtk_label_new("TODO rest of the privacy options"),
474 FALSE, FALSE, 0); 487 FALSE, FALSE, 0);
488 gtk_box_pack_start(GTK_BOX(cookie_controls), button_hbox, FALSE, FALSE, 0);
475 489
476 // Init member prefs so we can update the controls if prefs change. 490 // Init member prefs so we can update the controls if prefs change.
477 alternate_error_pages_.Init(prefs::kAlternateErrorPagesEnabled, 491 alternate_error_pages_.Init(prefs::kAlternateErrorPagesEnabled,
478 profile->GetPrefs(), this); 492 profile->GetPrefs(), this);
479 use_suggest_.Init(prefs::kSearchSuggestEnabled, 493 use_suggest_.Init(prefs::kSearchSuggestEnabled,
480 profile->GetPrefs(), this); 494 profile->GetPrefs(), this);
481 dns_prefetch_enabled_.Init(prefs::kDnsPrefetchingEnabled, 495 dns_prefetch_enabled_.Init(prefs::kDnsPrefetchingEnabled,
482 profile->GetPrefs(), this); 496 profile->GetPrefs(), this);
483 safe_browsing_.Init(prefs::kSafeBrowsingEnabled, profile->GetPrefs(), this); 497 safe_browsing_.Init(prefs::kSafeBrowsingEnabled, profile->GetPrefs(), this);
484 enable_metrics_recording_.Init(prefs::kMetricsReportingEnabled, 498 enable_metrics_recording_.Init(prefs::kMetricsReportingEnabled,
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 if (cookie_policy < 0 || 611 if (cookie_policy < 0 ||
598 static_cast<size_t>(cookie_policy) >= arraysize(kUserMetrics)) { 612 static_cast<size_t>(cookie_policy) >= arraysize(kUserMetrics)) {
599 NOTREACHED(); 613 NOTREACHED();
600 return; 614 return;
601 } 615 }
602 privacy_section->UserMetricsRecordAction( 616 privacy_section->UserMetricsRecordAction(
603 kUserMetrics[cookie_policy], privacy_section->profile()->GetPrefs()); 617 kUserMetrics[cookie_policy], privacy_section->profile()->GetPrefs());
604 privacy_section->cookie_behavior_.SetValue(cookie_policy); 618 privacy_section->cookie_behavior_.SetValue(cookie_policy);
605 } 619 }
606 620
621 // static
622 void PrivacySection::OnShowCookiesButtonClicked(
623 GtkButton *button, PrivacySection* privacy_section) {
624 privacy_section->UserMetricsRecordAction(L"Options_ShowCookies", NULL);
625 CookiesView::Show(privacy_section->profile());
626 }
627
607 void PrivacySection::NotifyPrefChanged(const std::wstring* pref_name) { 628 void PrivacySection::NotifyPrefChanged(const std::wstring* pref_name) {
608 initializing_ = true; 629 initializing_ = true;
609 if (!pref_name || *pref_name == prefs::kAlternateErrorPagesEnabled) { 630 if (!pref_name || *pref_name == prefs::kAlternateErrorPagesEnabled) {
610 gtk_toggle_button_set_active( 631 gtk_toggle_button_set_active(
611 GTK_TOGGLE_BUTTON(enable_link_doctor_checkbox_), 632 GTK_TOGGLE_BUTTON(enable_link_doctor_checkbox_),
612 alternate_error_pages_.GetValue()); 633 alternate_error_pages_.GetValue());
613 } 634 }
614 if (!pref_name || *pref_name == prefs::kSearchSuggestEnabled) { 635 if (!pref_name || *pref_name == prefs::kSearchSuggestEnabled) {
615 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(enable_suggest_checkbox_), 636 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(enable_suggest_checkbox_),
616 use_suggest_.GetValue()); 637 use_suggest_.GetValue());
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 l10n_util::GetStringUTF8(IDS_OPTIONS_ADVANCED_SECTION_TITLE_CONTENT), 839 l10n_util::GetStringUTF8(IDS_OPTIONS_ADVANCED_SECTION_TITLE_CONTENT),
819 web_content_section_->get_page_widget(), false); 840 web_content_section_->get_page_widget(), false);
820 841
821 security_section_.reset(new SecuritySection(profile_)); 842 security_section_.reset(new SecuritySection(profile_));
822 options_builder.AddOptionGroup( 843 options_builder.AddOptionGroup(
823 l10n_util::GetStringUTF8(IDS_OPTIONS_ADVANCED_SECTION_TITLE_SECURITY), 844 l10n_util::GetStringUTF8(IDS_OPTIONS_ADVANCED_SECTION_TITLE_SECURITY),
824 security_section_->get_page_widget(), false); 845 security_section_->get_page_widget(), false);
825 846
826 page_ = options_builder.get_page_widget(); 847 page_ = options_builder.get_page_widget();
827 } 848 }
OLDNEW
« no previous file with comments | « chrome/browser/cookies_table_model.cc ('k') | chrome/browser/gtk/options/cookies_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698