summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/app/generated_resources.grd3
-rw-r--r--chrome/app/resources/locale_settings.grd2
-rw-r--r--chrome/browser/browser.cc1
-rw-r--r--chrome/browser/browsing_data_remover.cc9
-rw-r--r--chrome/browser/browsing_data_remover.h1
-rw-r--r--chrome/browser/gtk/clear_browsing_data_dialog_gtk.cc16
-rw-r--r--chrome/browser/gtk/clear_browsing_data_dialog_gtk.h1
-rw-r--r--chrome/browser/views/clear_browsing_data.cc25
-rw-r--r--chrome/browser/views/clear_browsing_data.h1
-rw-r--r--chrome/common/pref_names.cc1
-rw-r--r--chrome/common/pref_names.h1
-rw-r--r--net/base/strict_transport_security_state.cc7
-rw-r--r--net/base/strict_transport_security_state.h3
-rw-r--r--net/base/strict_transport_security_state_unittest.cc14
14 files changed, 81 insertions, 4 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index 8c5a990..53acf52 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -2726,6 +2726,9 @@ Keep your key file in a safe place. You will need it to create new versions of y
<message name="IDS_DEL_FORM_DATA_CHKBOX" desc="Checkbox for deleting form data saved for autofill">
Clear saved form data
</message>
+ <message name="IDS_DEL_STS_STATE" desc="Checkbox for deleting Strict Transport Security state. Strict Transport Security is a protocol name (like File Transfer Protocol) so one may choose to leave it untranslated.">
+ Clear Strict-Transport-Security state
+ </message>
<message name="IDS_CLEAR_BROWSING_DATA_COMMIT" desc="Text for OK button on dialog">
Clear Browsing Data
</message>
diff --git a/chrome/app/resources/locale_settings.grd b/chrome/app/resources/locale_settings.grd
index 90d69a1..b2d539a 100644
--- a/chrome/app/resources/locale_settings.grd
+++ b/chrome/app/resources/locale_settings.grd
@@ -375,7 +375,7 @@
63
</message>
<message name="IDS_CLEARDATA_DIALOG_HEIGHT_LINES" use_name_for_id="true">
- 16
+ 18
</message>
<!-- The width and height of the Import dialog box in characters and lines (See -->
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index d5a87e6..c8c1da1 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -1298,6 +1298,7 @@ void Browser::RegisterUserPrefs(PrefService* prefs) {
prefs->RegisterBooleanPref(prefs::kDeleteCookies, true);
prefs->RegisterBooleanPref(prefs::kDeletePasswords, false);
prefs->RegisterBooleanPref(prefs::kDeleteFormData, true);
+ prefs->RegisterBooleanPref(prefs::kDeleteSTSState, false);
prefs->RegisterIntegerPref(prefs::kDeleteTimePeriod, 0);
prefs->RegisterBooleanPref(prefs::kCheckDefaultBrowser, true);
prefs->RegisterBooleanPref(prefs::kShowOmniboxSearchHint, true);
diff --git a/chrome/browser/browsing_data_remover.cc b/chrome/browser/browsing_data_remover.cc
index 96e1543..b971187 100644
--- a/chrome/browser/browsing_data_remover.cc
+++ b/chrome/browser/browsing_data_remover.cc
@@ -17,6 +17,7 @@
#include "chrome/browser/webdata/web_data_service.h"
#include "chrome/common/notification_service.h"
#include "net/base/cookie_monster.h"
+#include "net/base/strict_transport_security_state.h"
#include "net/disk_cache/disk_cache.h"
#include "net/http/http_cache.h"
#include "net/url_request/url_request_context.h"
@@ -147,6 +148,14 @@ void BrowsingDataRemover::Remove(int remove_mask) {
}
}
+ if (remove_mask & REMOVE_STS_STATE) {
+ UserMetrics::RecordAction(L"ClearBrowsingData_STSState", profile_);
+
+ net::StrictTransportSecurityState* sts_state =
+ profile_->GetStrictTransportSecurityState();
+ sts_state->Clear();
+ }
+
NotifyAndDeleteIfDone();
}
diff --git a/chrome/browser/browsing_data_remover.h b/chrome/browser/browsing_data_remover.h
index 0425c6f..841358b 100644
--- a/chrome/browser/browsing_data_remover.h
+++ b/chrome/browser/browsing_data_remover.h
@@ -35,6 +35,7 @@ class BrowsingDataRemover : public NotificationObserver {
static const int REMOVE_PASSWORDS = 1 << 3;
static const int REMOVE_FORM_DATA = 1 << 4;
static const int REMOVE_CACHE = 1 << 5;
+ static const int REMOVE_STS_STATE = 1 << 6; // always removes everything.
// Observer is notified when the removal is done. Done means keywords have
// been deleted, cache cleared and all other tasks scheduled.
diff --git a/chrome/browser/gtk/clear_browsing_data_dialog_gtk.cc b/chrome/browser/gtk/clear_browsing_data_dialog_gtk.cc
index 07b911d..9e07795 100644
--- a/chrome/browser/gtk/clear_browsing_data_dialog_gtk.cc
+++ b/chrome/browser/gtk/clear_browsing_data_dialog_gtk.cc
@@ -99,6 +99,15 @@ ClearBrowsingDataDialogGtk::ClearBrowsingDataDialogGtk(GtkWindow* parent,
g_signal_connect(del_form_data_checkbox_, "toggled",
G_CALLBACK(HandleOnClickedWidget), this);
+ // Strict transport security state checkbox.
+ del_sts_checkbox_ = gtk_check_button_new_with_label(
+ l10n_util::GetStringUTF8(IDS_DEL_STS_STATE).c_str());
+ gtk_box_pack_start(GTK_BOX(vbox), del_sts_checkbox_, FALSE, FALSE, 0);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(del_sts_checkbox_),
+ profile_->GetPrefs()->GetBoolean(prefs::kDeleteSTSState));
+ g_signal_connect(del_sts_checkbox_, "toggled",
+ G_CALLBACK(HandleOnClickedWidget), this);
+
// Create a horizontal layout for the combo box and label.
GtkWidget* combo_hbox = gtk_hbox_new(FALSE, gtk_util::kLabelSpacing);
GtkWidget* time_period_label_ = gtk_label_new(
@@ -157,6 +166,9 @@ void ClearBrowsingDataDialogGtk::OnDialogResponse(GtkWidget* widget,
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(del_cache_checkbox_)))
items |= BrowsingDataRemover::REMOVE_CACHE;
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(del_sts_checkbox_)))
+ items |= BrowsingDataRemover::REMOVE_STS_STATE;
+
// BrowsingDataRemover deletes itself when done.
remover_ = new BrowsingDataRemover(profile_,
static_cast<BrowsingDataRemover::TimePeriod>(period_selected),
@@ -193,6 +205,10 @@ void ClearBrowsingDataDialogGtk::OnDialogWidgetClicked(GtkWidget* widget) {
profile_->GetPrefs()->SetBoolean(prefs::kDeleteFormData,
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)) ?
true : false);
+ } else if (widget == del_sts_checkbox_) {
+ profile_->GetPrefs()->SetBoolean(prefs::kDeleteSTSState,
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)) ?
+ true : false);
} else if (widget == time_period_combobox_) {
profile_->GetPrefs()->SetInteger(prefs::kDeleteTimePeriod,
gtk_combo_box_get_active(GTK_COMBO_BOX(widget)));
diff --git a/chrome/browser/gtk/clear_browsing_data_dialog_gtk.h b/chrome/browser/gtk/clear_browsing_data_dialog_gtk.h
index 46a3c73..794cfe0 100644
--- a/chrome/browser/gtk/clear_browsing_data_dialog_gtk.h
+++ b/chrome/browser/gtk/clear_browsing_data_dialog_gtk.h
@@ -44,6 +44,7 @@ class ClearBrowsingDataDialogGtk {
GtkWidget* del_cookies_checkbox_;
GtkWidget* del_passwords_checkbox_;
GtkWidget* del_form_data_checkbox_;
+ GtkWidget* del_sts_checkbox_;
GtkWidget* time_period_combobox_;
// Our current profile.
diff --git a/chrome/browser/views/clear_browsing_data.cc b/chrome/browser/views/clear_browsing_data.cc
index 385095a..e5716e5 100644
--- a/chrome/browser/views/clear_browsing_data.cc
+++ b/chrome/browser/views/clear_browsing_data.cc
@@ -47,6 +47,7 @@ ClearBrowsingDataView::ClearBrowsingDataView(Profile* profile)
del_cookies_checkbox_(NULL),
del_passwords_checkbox_(NULL),
del_form_data_checkbox_(NULL),
+ del_sts_checkbox_(NULL),
time_period_label_(NULL),
time_period_combobox_(NULL),
delete_in_progress_(false),
@@ -106,6 +107,10 @@ void ClearBrowsingDataView::Init() {
AddCheckbox(l10n_util::GetString(IDS_DEL_FORM_DATA_CHKBOX),
profile_->GetPrefs()->GetBoolean(prefs::kDeleteFormData));
+ del_sts_checkbox_ =
+ AddCheckbox(l10n_util::GetString(IDS_DEL_STS_STATE),
+ profile_->GetPrefs()->GetBoolean(prefs::kDeleteSTSState));
+
// Add a label which appears before the combo box for the time period.
time_period_label_ = new views::Label(
l10n_util::GetString(IDS_CLEAR_BROWSING_DATA_TIME_LABEL));
@@ -179,11 +184,18 @@ void ClearBrowsingDataView::Layout() {
kRelatedControlVerticalSpacing,
sz.width(), sz.height());
+ sz = del_sts_checkbox_->GetPreferredSize();
+ del_sts_checkbox_->SetBounds(2 * kPanelHorizMargin,
+ del_form_data_checkbox_->y() +
+ del_form_data_checkbox_->height() +
+ kRelatedControlVerticalSpacing,
+ sz.width(), sz.height());
+
// Time period label is next below the combo boxes.
sz = time_period_label_->GetPreferredSize();
time_period_label_->SetBounds(kPanelHorizMargin,
- del_form_data_checkbox_->y() +
- del_form_data_checkbox_->height() +
+ del_sts_checkbox_->y() +
+ del_sts_checkbox_->height() +
kRelatedControlVerticalSpacing +
kExtraMarginForTimePeriodLabel,
sz.width(), sz.height());
@@ -266,7 +278,8 @@ bool ClearBrowsingDataView::IsDialogButtonEnabled(
del_cache_checkbox_->checked() ||
del_cookies_checkbox_->checked() ||
del_passwords_checkbox_->checked() ||
- del_form_data_checkbox_->checked();
+ del_form_data_checkbox_->checked() ||
+ del_sts_checkbox_->checked();
}
return true;
@@ -359,6 +372,9 @@ void ClearBrowsingDataView::ButtonPressed(
else if (sender == del_form_data_checkbox_)
profile_->GetPrefs()->SetBoolean(prefs::kDeleteFormData,
del_form_data_checkbox_->checked() ? true : false);
+ else if (sender == del_sts_checkbox_)
+ profile_->GetPrefs()->SetBoolean(prefs::kDeleteSTSState,
+ del_sts_checkbox_->checked() ? 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.
@@ -386,6 +402,7 @@ void ClearBrowsingDataView::UpdateControlEnabledState() {
del_cookies_checkbox_->SetEnabled(!delete_in_progress_);
del_passwords_checkbox_->SetEnabled(!delete_in_progress_);
del_form_data_checkbox_->SetEnabled(!delete_in_progress_);
+ del_sts_checkbox_->SetEnabled(!delete_in_progress_);
time_period_combobox_->SetEnabled(!delete_in_progress_);
status_label_.SetVisible(delete_in_progress_);
@@ -421,6 +438,8 @@ void ClearBrowsingDataView::OnDelete() {
remove_mask |= BrowsingDataRemover::REMOVE_FORM_DATA;
if (IsCheckBoxEnabledAndSelected(del_cache_checkbox_))
remove_mask |= BrowsingDataRemover::REMOVE_CACHE;
+ if (IsCheckBoxEnabledAndSelected(del_sts_checkbox_))
+ remove_mask |= BrowsingDataRemover::REMOVE_STS_STATE;
delete_in_progress_ = true;
UpdateControlEnabledState();
diff --git a/chrome/browser/views/clear_browsing_data.h b/chrome/browser/views/clear_browsing_data.h
index 2514af9c..c045038 100644
--- a/chrome/browser/views/clear_browsing_data.h
+++ b/chrome/browser/views/clear_browsing_data.h
@@ -101,6 +101,7 @@ class ClearBrowsingDataView : public views::View,
views::Checkbox* del_cookies_checkbox_;
views::Checkbox* del_passwords_checkbox_;
views::Checkbox* del_form_data_checkbox_;
+ views::Checkbox* del_sts_checkbox_;
views::Label* time_period_label_;
views::Combobox* time_period_combobox_;
diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc
index a8afd36c..4294aaa 100644
--- a/chrome/common/pref_names.cc
+++ b/chrome/common/pref_names.cc
@@ -228,6 +228,7 @@ 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 kDeleteFormData[] = L"browser.clear_data.form_data";
+const wchar_t kDeleteSTSState[] = L"browser.clear_data.sts_state";
const wchar_t kDeleteTimePeriod[] = L"browser.clear_data.time_period";
// Integer prefs giving the widths of the columns in the bookmark table. Two
diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h
index 7432559..80f34d5 100644
--- a/chrome/common/pref_names.h
+++ b/chrome/common/pref_names.h
@@ -81,6 +81,7 @@ extern const wchar_t kDeleteCache[];
extern const wchar_t kDeleteCookies[];
extern const wchar_t kDeletePasswords[];
extern const wchar_t kDeleteFormData[];
+extern const wchar_t kDeleteSTSState[];
extern const wchar_t kBookmarkTableNameWidth1[];
extern const wchar_t kBookmarkTableURLWidth1[];
extern const wchar_t kBookmarkTableNameWidth2[];
diff --git a/net/base/strict_transport_security_state.cc b/net/base/strict_transport_security_state.cc
index fc267c5..cc812d9 100644
--- a/net/base/strict_transport_security_state.cc
+++ b/net/base/strict_transport_security_state.cc
@@ -187,6 +187,13 @@ bool StrictTransportSecurityState::ParseHeader(const std::string& value,
}
}
+void StrictTransportSecurityState::Clear() {
+ AutoLock lock(lock_);
+
+ enabled_hosts_.clear();
+ DirtyNotify();
+}
+
void StrictTransportSecurityState::SetDelegate(
StrictTransportSecurityState::Delegate* delegate) {
AutoLock lock(lock_);
diff --git a/net/base/strict_transport_security_state.h b/net/base/strict_transport_security_state.h
index 463382c..5739001 100644
--- a/net/base/strict_transport_security_state.h
+++ b/net/base/strict_transport_security_state.h
@@ -48,6 +48,9 @@ class StrictTransportSecurityState :
int* max_age,
bool* include_subdomains);
+ // Deletes all the state and notifies the delegate that the state is dirty.
+ void Clear();
+
struct State {
base::Time expiry; // the absolute time (UTC) when this record expires
bool include_subdomains; // subdomains included?
diff --git a/net/base/strict_transport_security_state_unittest.cc b/net/base/strict_transport_security_state_unittest.cc
index 5ebd358..2b769d7 100644
--- a/net/base/strict_transport_security_state_unittest.cc
+++ b/net/base/strict_transport_security_state_unittest.cc
@@ -204,3 +204,17 @@ TEST_F(StrictTransportSecurityStateTest, Serialise2) {
EXPECT_TRUE(state->IsEnabledForHost("foo.bar.baz.google.com"));
EXPECT_FALSE(state->IsEnabledForHost("com"));
}
+
+TEST_F(StrictTransportSecurityStateTest, Clear) {
+ scoped_refptr<net::StrictTransportSecurityState> state(
+ new net::StrictTransportSecurityState);
+
+ const base::Time current_time(base::Time::Now());
+ const base::Time expiry = current_time + base::TimeDelta::FromSeconds(1000);
+
+ EXPECT_FALSE(state->IsEnabledForHost("google.com"));
+ state->EnableHost("google.com", expiry, true);
+ EXPECT_TRUE(state->IsEnabledForHost("google.com"));
+ state->Clear();
+ EXPECT_FALSE(state->IsEnabledForHost("google.com"));
+}