summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/browser.cc1
-rw-r--r--chrome/browser/views/clear_browsing_data.cc12
-rw-r--r--chrome/browser/views/clear_browsing_data.h5
-rw-r--r--chrome/common/pref_names.cc5
-rw-r--r--chrome/common/pref_names.h1
5 files changed, 21 insertions, 3 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index d7fd0fe..a876d60 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -185,6 +185,7 @@ void Browser::RegisterUserPrefs(PrefService* prefs) {
prefs->RegisterBooleanPref(prefs::kDeleteCache, true);
prefs->RegisterBooleanPref(prefs::kDeleteCookies, true);
prefs->RegisterBooleanPref(prefs::kDeletePasswords, false);
+ prefs->RegisterIntegerPref(prefs::kDeleteTimePeriod, 0);
}
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 0b2b6f5..c4c88f4 100644
--- a/chrome/browser/views/clear_browsing_data.cc
+++ b/chrome/browser/views/clear_browsing_data.cc
@@ -98,6 +98,9 @@ void ClearBrowsingDataView::Init() {
// Add the combo box showing how far back in time we want to delete.
time_period_combobox_ = new views::ComboBox(this);
+ time_period_combobox_->SetSelectedItem(profile_->GetPrefs()->GetInteger(
+ prefs::kDeleteTimePeriod));
+ time_period_combobox_->SetListener(this);
AddChildView(time_period_combobox_);
}
@@ -302,6 +305,15 @@ std::wstring ClearBrowsingDataView::GetItemAt(views::ComboBox* source,
}
////////////////////////////////////////////////////////////////////////////////
+// ClearBrowsingDataView, views::ComboBoxListener implementation:
+
+void ClearBrowsingDataView::ItemChanged(views::ComboBox* sender,
+ int prev_index, int new_index) {
+ if (sender == time_period_combobox_ && prev_index != new_index)
+ profile_->GetPrefs()->SetInteger(prefs::kDeleteTimePeriod, new_index);
+}
+
+////////////////////////////////////////////////////////////////////////////////
// ClearBrowsingDataView, views::ButtonListener implementation:
void ClearBrowsingDataView::ButtonPressed(views::NativeButton* sender) {
diff --git a/chrome/browser/views/clear_browsing_data.h b/chrome/browser/views/clear_browsing_data.h
index 9b000fb..f32f31d 100644
--- a/chrome/browser/views/clear_browsing_data.h
+++ b/chrome/browser/views/clear_browsing_data.h
@@ -34,6 +34,7 @@ class ClearBrowsingDataView : public views::View,
public views::DialogDelegate,
public views::ComboBox::Model,
public views::NativeButton::Listener,
+ public views::ComboBox::Listener,
public BrowsingDataRemover::Observer {
public:
explicit ClearBrowsingDataView(Profile* profile);
@@ -68,6 +69,10 @@ class ClearBrowsingDataView : public views::View,
// Overridden from views::NativeButton::Listener:
virtual void ButtonPressed(views::NativeButton* sender);
+ // Overridden from views::ComboBox::Listener:
+ virtual void ItemChanged(views::ComboBox* sender, int prev_index,
+ int new_index);
+
private:
// Adds a new check-box as a child to the view.
views::CheckBox* AddCheckbox(const std::wstring& text, bool checked);
diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc
index 9d2be21..f5c7b06 100644
--- a/chrome/common/pref_names.cc
+++ b/chrome/common/pref_names.cc
@@ -193,15 +193,14 @@ 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.
+// Clear Browsing Data dialog preferences.
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";
-
+const wchar_t kDeleteTimePeriod[] = L"browser.clear_data.time_period";
// *************** LOCAL STATE ***************
// These are attached to the machine/installation
diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h
index b8dd143..973dfb4 100644
--- a/chrome/common/pref_names.h
+++ b/chrome/common/pref_names.h
@@ -68,6 +68,7 @@ extern const wchar_t kDeleteDownloadHistory[];
extern const wchar_t kDeleteCache[];
extern const wchar_t kDeleteCookies[];
extern const wchar_t kDeletePasswords[];
+extern const wchar_t kDeleteTimePeriod[];
// Local state
extern const wchar_t kAvailableProfiles[];