diff options
-rw-r--r-- | AUTHORS | 1 | ||||
-rw-r--r-- | chrome/browser/browser.cc | 5 | ||||
-rw-r--r-- | chrome/browser/views/clear_browsing_data.cc | 33 | ||||
-rw-r--r-- | chrome/common/pref_names.cc | 9 | ||||
-rw-r--r-- | chrome/common/pref_names.h | 5 |
5 files changed, 48 insertions, 5 deletions
@@ -12,3 +12,4 @@ James Vega <vega.james@gmail.com> Marco Rodrigues <gothicx@gmail.com> Matthias Reitinger <reimarvin@gmail.com> Peter Bright <drpizza@quiscalusmexicanus.org> +Arthur Lussos <developer0420@gmail.com> diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index 235edbf..52706f5 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -179,6 +179,11 @@ void Browser::RegisterUserPrefs(PrefService* prefs) { net::CookiePolicy::ALLOW_ALL_COOKIES); prefs->RegisterBooleanPref(prefs::kShowHomeButton, false); prefs->RegisterStringPref(prefs::kRecentlySelectedEncoding, L""); + prefs->RegisterBooleanPref(prefs::kDeleteBrowsingHistory, true); + prefs->RegisterBooleanPref(prefs::kDeleteDownloadHistory, true); + prefs->RegisterBooleanPref(prefs::kDeleteCache, true); + prefs->RegisterBooleanPref(prefs::kDeleteCookies, true); + prefs->RegisterBooleanPref(prefs::kDeletePasswords, false); } Browser::Browser(const gfx::Rect& initial_bounds, diff --git a/chrome/browser/views/clear_browsing_data.cc b/chrome/browser/views/clear_browsing_data.cc index c81b63d..06d9b6d 100644 --- a/chrome/browser/views/clear_browsing_data.cc +++ b/chrome/browser/views/clear_browsing_data.cc @@ -15,6 +15,8 @@ #include "chrome/views/native_button.h" #include "chrome/views/throbber.h" #include "chrome/views/window.h" +#include "chrome/common/pref_names.h" +#include "chrome/common/pref_service.h" #include "net/url_request/url_request_context.h" #include "generated_resources.h" @@ -70,19 +72,24 @@ void ClearBrowsingDataView::Init() { // Add all the check-boxes. del_history_checkbox_ = - AddCheckbox(l10n_util::GetString(IDS_DEL_BROWSING_HISTORY_CHKBOX), true); + AddCheckbox(l10n_util::GetString(IDS_DEL_BROWSING_HISTORY_CHKBOX), + profile_->GetPrefs()->GetBoolean(prefs::kDeleteBrowsingHistory)); del_downloads_checkbox_ = - AddCheckbox(l10n_util::GetString(IDS_DEL_DOWNLOAD_HISTORY_CHKBOX), true); + AddCheckbox(l10n_util::GetString(IDS_DEL_DOWNLOAD_HISTORY_CHKBOX), + profile_->GetPrefs()->GetBoolean(prefs::kDeleteDownloadHistory)); del_cache_checkbox_ = - AddCheckbox(l10n_util::GetString(IDS_DEL_CACHE_CHKBOX), true); + AddCheckbox(l10n_util::GetString(IDS_DEL_CACHE_CHKBOX), + profile_->GetPrefs()->GetBoolean(prefs::kDeleteCache)); del_cookies_checkbox_ = - AddCheckbox(l10n_util::GetString(IDS_DEL_COOKIES_CHKBOX), true); + AddCheckbox(l10n_util::GetString(IDS_DEL_COOKIES_CHKBOX), + profile_->GetPrefs()->GetBoolean(prefs::kDeleteCookies)); del_passwords_checkbox_ = - AddCheckbox(l10n_util::GetString(IDS_DEL_PASSWORDS_CHKBOX), false); + AddCheckbox(l10n_util::GetString(IDS_DEL_PASSWORDS_CHKBOX), + profile_->GetPrefs()->GetBoolean(prefs::kDeletePasswords)); // Add a label which appears before the combo box for the time period. time_period_label_ = new ChromeViews::Label( @@ -302,6 +309,22 @@ std::wstring ClearBrowsingDataView::GetItemAt(ChromeViews::ComboBox* source, // ClearBrowsingDataView, ChromeViews::ButtonListener implementation: void ClearBrowsingDataView::ButtonPressed(ChromeViews::NativeButton* sender) { + if (sender == del_history_checkbox_) + profile_->GetPrefs()->SetBoolean(prefs::kDeleteBrowsingHistory, + del_history_checkbox_->IsSelected() ? true : false); + else if (sender == del_downloads_checkbox_) + profile_->GetPrefs()->SetBoolean(prefs::kDeleteDownloadHistory, + del_downloads_checkbox_->IsSelected() ? true : false); + else if (sender == del_cache_checkbox_) + profile_->GetPrefs()->SetBoolean(prefs::kDeleteCache, + del_cache_checkbox_->IsSelected() ? true : false); + else if (sender == del_cookies_checkbox_) + profile_->GetPrefs()->SetBoolean(prefs::kDeleteCookies, + del_cookies_checkbox_->IsSelected() ? true : false); + else if (sender == del_passwords_checkbox_) + profile_->GetPrefs()->SetBoolean(prefs::kDeletePasswords, + del_passwords_checkbox_->IsSelected() ? true : false); + // When no checkbox is checked we should not have the action button enabled. // This forces the button to evaluate what state they should be in. GetDialogClientView()->UpdateDialogButtons(); diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc index b664b24..9d2be21 100644 --- a/chrome/common/pref_names.cc +++ b/chrome/common/pref_names.cc @@ -193,6 +193,15 @@ const wchar_t kShowHomeButton[] = L"browser.show_home_button"; const wchar_t kRecentlySelectedEncoding[] = L"profile.recently_selected_encodings"; +// Boolean prefs that define the default values for the check boxes in the Clear +// Browsing Data dialog. +const wchar_t kDeleteBrowsingHistory[] = L"browser.clear_data.browsing_history"; +const wchar_t kDeleteDownloadHistory[] = + L"browser.clear_data.download_history"; +const wchar_t kDeleteCache[] = L"browser.clear_data.cache"; +const wchar_t kDeleteCookies[] = L"browser.clear_data.cookies"; +const wchar_t kDeletePasswords[] = L"browser.clear_data.passwords"; + // *************** LOCAL STATE *************** // These are attached to the machine/installation diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h index a3c4736..b8dd143 100644 --- a/chrome/common/pref_names.h +++ b/chrome/common/pref_names.h @@ -63,6 +63,11 @@ extern const wchar_t kDnsStartupPrefetchList[]; extern const wchar_t kIpcDisabledMessages[]; extern const wchar_t kShowHomeButton[]; extern const wchar_t kRecentlySelectedEncoding[]; +extern const wchar_t kDeleteBrowsingHistory[]; +extern const wchar_t kDeleteDownloadHistory[]; +extern const wchar_t kDeleteCache[]; +extern const wchar_t kDeleteCookies[]; +extern const wchar_t kDeletePasswords[]; // Local state extern const wchar_t kAvailableProfiles[]; |