summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/browser.cc4
-rw-r--r--chrome/browser/browser.h2
-rw-r--r--chrome/browser/browsing_data_remover.cc47
-rw-r--r--chrome/browser/browsing_data_remover.h16
-rw-r--r--chrome/browser/gtk/browser_window_gtk.cc3
-rw-r--r--chrome/browser/gtk/clear_browsing_data_dialog_gtk.cc197
-rw-r--r--chrome/browser/gtk/clear_browsing_data_dialog_gtk.h57
-rw-r--r--chrome/browser/views/clear_browsing_data.cc20
-rw-r--r--chrome/chrome.gyp2
9 files changed, 319 insertions, 29 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index 3a02939..ba8b63b 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -1130,12 +1130,10 @@ void Browser::ShowDownloadsTab() {
ShowSingleDOMUITab(GURL(chrome::kChromeUIDownloadsURL));
}
-#if defined(OS_WIN)
void Browser::OpenClearBrowsingDataDialog() {
UserMetrics::RecordAction(L"ClearBrowsingData_ShowDlg", profile_);
window_->ShowClearBrowsingDataDialog();
}
-#endif
void Browser::OpenOptionsDialog() {
UserMetrics::RecordAction(L"ShowOptions", profile_);
@@ -1371,7 +1369,6 @@ void Browser::ExecuteCommandWithDisposition(
case IDC_P13N_INFO:
Personalization::HandleMenuItemClick(profile()); break;
#endif
- case IDC_CLEAR_BROWSING_DATA: OpenClearBrowsingDataDialog(); break;
#endif
case IDC_OPTIONS: OpenOptionsDialog(); break;
#if defined(OS_WIN)
@@ -1379,6 +1376,7 @@ void Browser::ExecuteCommandWithDisposition(
case IDC_VIEW_PASSWORDS: OpenPasswordManager(); break;
#endif
#if defined(OS_WIN) || defined(OS_LINUX)
+ case IDC_CLEAR_BROWSING_DATA: OpenClearBrowsingDataDialog(); break;
case IDC_IMPORT_SETTINGS: OpenImportSettingsDialog(); break;
#endif
case IDC_ABOUT: OpenAboutChromeDialog(); break;
diff --git a/chrome/browser/browser.h b/chrome/browser/browser.h
index dac3877..92242f0 100644
--- a/chrome/browser/browser.h
+++ b/chrome/browser/browser.h
@@ -370,9 +370,7 @@ class Browser : public TabStripModelDelegate,
#endif
void ShowHistoryTab();
void ShowDownloadsTab();
-#if defined(OS_WIN)
void OpenClearBrowsingDataDialog();
-#endif
void OpenOptionsDialog();
#if defined(OS_WIN)
void OpenKeywordEditor();
diff --git a/chrome/browser/browsing_data_remover.cc b/chrome/browser/browsing_data_remover.cc
index 33a0c6d..0929238 100644
--- a/chrome/browser/browsing_data_remover.cc
+++ b/chrome/browser/browsing_data_remover.cc
@@ -21,8 +21,6 @@
#include "net/url_request/url_request_context.h"
#include "webkit/glue/password_form.h"
-using base::Time;
-
// Done so that we can use invokeLater on BrowsingDataRemovers and not have
// BrowsingDataRemover implement RefCounted.
template<>
@@ -36,8 +34,9 @@ void RunnableMethodTraits<BrowsingDataRemover>::ReleaseCallee(
bool BrowsingDataRemover::removing_ = false;
-BrowsingDataRemover::BrowsingDataRemover(Profile* profile, Time delete_begin,
- Time delete_end)
+BrowsingDataRemover::BrowsingDataRemover(Profile* profile,
+ base::Time delete_begin,
+ base::Time delete_end)
: profile_(profile),
delete_begin_(delete_begin),
delete_end_(delete_end),
@@ -47,6 +46,18 @@ BrowsingDataRemover::BrowsingDataRemover(Profile* profile, Time delete_begin,
DCHECK(profile);
}
+BrowsingDataRemover::BrowsingDataRemover(Profile* profile,
+ TimePeriod time_period,
+ base::Time delete_end)
+ : profile_(profile),
+ delete_begin_(CalculateBeginDeleteTime(time_period)),
+ delete_end_(delete_end),
+ waiting_for_keywords_(false),
+ waiting_for_clear_history_(false),
+ waiting_for_clear_cache_(false) {
+ DCHECK(profile);
+}
+
BrowsingDataRemover::~BrowsingDataRemover() {
DCHECK(all_done());
}
@@ -154,6 +165,30 @@ void BrowsingDataRemover::OnHistoryDeletionDone() {
NotifyAndDeleteIfDone();
}
+base::Time BrowsingDataRemover::CalculateBeginDeleteTime(
+ TimePeriod time_period) {
+ base::TimeDelta diff;
+ base::Time delete_begin_time = base::Time::Now();
+ switch (time_period) {
+ case LAST_DAY:
+ diff = base::TimeDelta::FromHours(24);
+ break;
+ case LAST_WEEK:
+ diff = base::TimeDelta::FromHours(7*24);
+ break;
+ case FOUR_WEEKS:
+ diff = base::TimeDelta::FromHours(4*7*24);
+ break;
+ case EVERYTHING:
+ delete_begin_time = base::Time();
+ break;
+ default:
+ NOTREACHED() << L"Missing item";
+ break;
+ }
+ return delete_begin_time - diff;
+}
+
void BrowsingDataRemover::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
@@ -195,8 +230,8 @@ void BrowsingDataRemover::ClearedCache() {
NotifyAndDeleteIfDone();
}
-void BrowsingDataRemover::ClearCacheOnIOThread(Time delete_begin,
- Time delete_end,
+void BrowsingDataRemover::ClearCacheOnIOThread(base::Time delete_begin,
+ base::Time delete_end,
MessageLoop* ui_loop) {
// This function should be called on the IO thread.
DCHECK(MessageLoop::current() ==
diff --git a/chrome/browser/browsing_data_remover.h b/chrome/browser/browsing_data_remover.h
index 96c8305..62172a0 100644
--- a/chrome/browser/browsing_data_remover.h
+++ b/chrome/browser/browsing_data_remover.h
@@ -18,6 +18,14 @@ class Profile;
class BrowsingDataRemover : public NotificationObserver {
public:
+ // Time period ranges available when doing browsing data removals.
+ enum TimePeriod {
+ LAST_DAY = 0,
+ LAST_WEEK,
+ FOUR_WEEKS,
+ EVERYTHING
+ };
+
// Mask used for Remove.
// In addition to visits, this removes keywords and the last session.
@@ -39,6 +47,11 @@ class BrowsingDataRemover : public NotificationObserver {
// profile in the specified time range. Use Remove to initiate the removal.
BrowsingDataRemover(Profile* profile, base::Time delete_begin,
base::Time delete_end);
+
+ // Creates a BrowsingDataRemover to remove browser data from the specified
+ // profile in the specified time range.
+ BrowsingDataRemover(Profile* profile, TimePeriod time_period,
+ base::Time delete_end);
~BrowsingDataRemover();
// Removes the specified items related to browsing.
@@ -72,6 +85,9 @@ class BrowsingDataRemover : public NotificationObserver {
base::Time delete_end,
MessageLoop* ui_loop);
+ // Calculate the begin time for the deletion range specified by |time_period|.
+ base::Time CalculateBeginDeleteTime(TimePeriod time_period);
+
// Returns true if we're all done.
bool all_done() {
return !waiting_for_keywords_ && !waiting_for_clear_cache_ &&
diff --git a/chrome/browser/gtk/browser_window_gtk.cc b/chrome/browser/gtk/browser_window_gtk.cc
index 1067340..3a97c6c 100644
--- a/chrome/browser/gtk/browser_window_gtk.cc
+++ b/chrome/browser/gtk/browser_window_gtk.cc
@@ -21,6 +21,7 @@
#include "chrome/browser/gtk/about_chrome_dialog.h"
#include "chrome/browser/gtk/bookmark_bar_gtk.h"
#include "chrome/browser/gtk/browser_toolbar_gtk.h"
+#include "chrome/browser/gtk/clear_browsing_data_dialog_gtk.h"
#include "chrome/browser/gtk/go_button_gtk.h"
#include "chrome/browser/gtk/import_dialog_gtk.h"
#include "chrome/browser/gtk/infobar_container_gtk.h"
@@ -569,7 +570,7 @@ void BrowserWindowGtk::ShowReportBugDialog() {
}
void BrowserWindowGtk::ShowClearBrowsingDataDialog() {
- NOTIMPLEMENTED();
+ ClearBrowsingDataDialogGtk::Show(window_, browser_->profile());
}
void BrowserWindowGtk::ShowImportDialog() {
diff --git a/chrome/browser/gtk/clear_browsing_data_dialog_gtk.cc b/chrome/browser/gtk/clear_browsing_data_dialog_gtk.cc
new file mode 100644
index 0000000..35f8432
--- /dev/null
+++ b/chrome/browser/gtk/clear_browsing_data_dialog_gtk.cc
@@ -0,0 +1,197 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/gtk/clear_browsing_data_dialog_gtk.h"
+
+#include "app/l10n_util.h"
+#include "app/resource_bundle.h"
+#include "chrome/browser/profile.h"
+#include "chrome/common/pref_names.h"
+#include "chrome/common/pref_service.h"
+#include "grit/generated_resources.h"
+
+// static
+void ClearBrowsingDataDialogGtk::Show(GtkWindow* parent, Profile* profile) {
+ new ClearBrowsingDataDialogGtk(parent, profile);
+}
+
+ClearBrowsingDataDialogGtk::ClearBrowsingDataDialogGtk(GtkWindow* parent,
+ Profile* profile) :
+ profile_(profile), remover_(NULL) {
+ // Build the dialog.
+ GtkWidget* dialog = gtk_dialog_new_with_buttons(
+ l10n_util::GetStringUTF8(IDS_CLEAR_BROWSING_DATA_TITLE).c_str(),
+ parent,
+ (GtkDialogFlags) (GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR),
+ GTK_STOCK_CANCEL,
+ GTK_RESPONSE_REJECT,
+ l10n_util::GetStringUTF8(IDS_CLEAR_BROWSING_DATA_COMMIT).c_str(),
+ GTK_RESPONSE_ACCEPT,
+ NULL);
+
+ GtkWidget* content_area = GTK_DIALOG(dialog)->vbox;
+ gtk_box_set_spacing(GTK_BOX(content_area), 18);
+
+ GtkWidget* vbox = gtk_vbox_new(FALSE, 6);
+ gtk_container_add(GTK_CONTAINER(content_area), vbox);
+
+ // Label on top of the checkboxes.
+ GtkWidget* description = gtk_label_new(
+ l10n_util::GetStringUTF8(IDS_CLEAR_BROWSING_DATA_LABEL).c_str());
+ gtk_misc_set_alignment(GTK_MISC(description), 0, 0);
+ gtk_box_pack_start(GTK_BOX(vbox), description, FALSE, FALSE, 0);
+
+ // History checkbox.
+ del_history_checkbox_ = gtk_check_button_new_with_label(
+ l10n_util::GetStringUTF8(IDS_DEL_BROWSING_HISTORY_CHKBOX).c_str());
+ gtk_box_pack_start(GTK_BOX(vbox), del_history_checkbox_, FALSE, FALSE, 0);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(del_history_checkbox_),
+ profile_->GetPrefs()->GetBoolean(prefs::kDeleteBrowsingHistory));
+ g_signal_connect(del_history_checkbox_, "toggled",
+ G_CALLBACK(HandleOnClickedWidget), this);
+
+ // Downloads checkbox.
+ del_downloads_checkbox_ = gtk_check_button_new_with_label(
+ l10n_util::GetStringUTF8(IDS_DEL_DOWNLOAD_HISTORY_CHKBOX).c_str());
+ gtk_box_pack_start(GTK_BOX(vbox), del_downloads_checkbox_, FALSE, FALSE, 0);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(del_downloads_checkbox_),
+ profile_->GetPrefs()->GetBoolean(prefs::kDeleteDownloadHistory));
+ g_signal_connect(del_downloads_checkbox_, "toggled",
+ G_CALLBACK(HandleOnClickedWidget), this);
+
+ // Cache checkbox.
+ del_cache_checkbox_ = gtk_check_button_new_with_label(
+ l10n_util::GetStringUTF8(IDS_DEL_CACHE_CHKBOX).c_str());
+ gtk_box_pack_start(GTK_BOX(vbox), del_cache_checkbox_, FALSE, FALSE, 0);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(del_cache_checkbox_),
+ profile_->GetPrefs()->GetBoolean(prefs::kDeleteCache));
+ g_signal_connect(del_cache_checkbox_, "toggled",
+ G_CALLBACK(HandleOnClickedWidget), this);
+
+ // Cookies checkbox.
+ del_cookies_checkbox_ = gtk_check_button_new_with_label(
+ l10n_util::GetStringUTF8(IDS_DEL_COOKIES_CHKBOX).c_str());
+ gtk_box_pack_start(GTK_BOX(vbox), del_cookies_checkbox_, FALSE, FALSE, 0);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(del_cookies_checkbox_),
+ profile_->GetPrefs()->GetBoolean(prefs::kDeleteCookies));
+ g_signal_connect(del_cookies_checkbox_, "toggled",
+ G_CALLBACK(HandleOnClickedWidget), this);
+
+ // Passwords checkbox.
+ del_passwords_checkbox_ = gtk_check_button_new_with_label(
+ l10n_util::GetStringUTF8(IDS_DEL_PASSWORDS_CHKBOX).c_str());
+ gtk_box_pack_start(GTK_BOX(vbox), del_passwords_checkbox_, FALSE, FALSE, 0);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(del_passwords_checkbox_),
+ profile_->GetPrefs()->GetBoolean(prefs::kDeletePasswords));
+ g_signal_connect(del_passwords_checkbox_, "toggled",
+ G_CALLBACK(HandleOnClickedWidget), this);
+
+ // Form data checkbox.
+ del_form_data_checkbox_ = gtk_check_button_new_with_label(
+ l10n_util::GetStringUTF8(IDS_DEL_FORM_DATA_CHKBOX).c_str());
+ gtk_box_pack_start(GTK_BOX(vbox), del_form_data_checkbox_, FALSE, FALSE, 0);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(del_form_data_checkbox_),
+ profile_->GetPrefs()->GetBoolean(prefs::kDeleteFormData));
+ g_signal_connect(del_form_data_checkbox_, "toggled",
+ G_CALLBACK(HandleOnClickedWidget), this);
+
+ // Create a horizontal layout for the combo box and label.
+ GtkWidget* combo_hbox = gtk_hbox_new(FALSE, 6);
+ GtkWidget* time_period_label_ = gtk_label_new(
+ l10n_util::GetStringUTF8(IDS_CLEAR_BROWSING_DATA_TIME_LABEL).c_str());
+ gtk_box_pack_start(GTK_BOX(combo_hbox), time_period_label_, FALSE, FALSE, 0);
+
+ // Time period combo box items.
+ time_period_combobox_ = gtk_combo_box_new_text();
+ gtk_combo_box_append_text(GTK_COMBO_BOX(time_period_combobox_),
+ l10n_util::GetStringUTF8(IDS_CLEAR_DATA_DAY).c_str());
+ gtk_combo_box_append_text(GTK_COMBO_BOX(time_period_combobox_),
+ l10n_util::GetStringUTF8(IDS_CLEAR_DATA_WEEK).c_str());
+ gtk_combo_box_append_text(GTK_COMBO_BOX(time_period_combobox_),
+ l10n_util::GetStringUTF8(IDS_CLEAR_DATA_4WEEKS).c_str());
+ gtk_combo_box_append_text(GTK_COMBO_BOX(time_period_combobox_),
+ l10n_util::GetStringUTF8(IDS_CLEAR_DATA_EVERYTHING).c_str());
+ gtk_combo_box_set_active(GTK_COMBO_BOX(time_period_combobox_),
+ profile_->GetPrefs()->GetInteger(prefs::kDeleteTimePeriod));
+ gtk_box_pack_start(GTK_BOX(combo_hbox),
+ time_period_combobox_, FALSE, FALSE, 0);
+ g_signal_connect(time_period_combobox_, "changed",
+ G_CALLBACK(HandleOnClickedWidget), this);
+
+ // Add the combo/label time period box to the vertical layout.
+ gtk_box_pack_start(GTK_BOX(vbox), combo_hbox, FALSE, FALSE, 0);
+
+ g_signal_connect(dialog, "response",
+ G_CALLBACK(HandleOnResponseDialog), this);
+ gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE);
+ gtk_widget_show_all(dialog);
+}
+
+void ClearBrowsingDataDialogGtk::OnDialogResponse(GtkWidget* widget,
+ int response) {
+ if (response == GTK_RESPONSE_ACCEPT) {
+ int period_selected = gtk_combo_box_get_active(
+ GTK_COMBO_BOX(time_period_combobox_));
+
+ int items = 0;
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(del_history_checkbox_)))
+ items |= BrowsingDataRemover::REMOVE_HISTORY;
+ if (gtk_toggle_button_get_active(
+ GTK_TOGGLE_BUTTON(del_downloads_checkbox_))) {
+ items |= BrowsingDataRemover::REMOVE_DOWNLOADS;
+ }
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(del_cookies_checkbox_)))
+ items |= BrowsingDataRemover::REMOVE_COOKIES;
+ if (gtk_toggle_button_get_active(
+ GTK_TOGGLE_BUTTON(del_passwords_checkbox_))) {
+ items |= BrowsingDataRemover::REMOVE_PASSWORDS;
+ }
+ if (gtk_toggle_button_get_active(
+ GTK_TOGGLE_BUTTON(del_form_data_checkbox_))) {
+ items |= BrowsingDataRemover::REMOVE_FORM_DATA;
+ }
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(del_cache_checkbox_)))
+ items |= BrowsingDataRemover::REMOVE_CACHE;
+
+ // BrowsingDataRemover deletes itself when done.
+ remover_ = new BrowsingDataRemover(profile_,
+ static_cast<BrowsingDataRemover::TimePeriod>(period_selected),
+ base::Time());
+ remover_->Remove(items);
+ }
+
+ delete this;
+ gtk_widget_destroy(GTK_WIDGET(widget));
+}
+
+void ClearBrowsingDataDialogGtk::OnDialogWidgetClicked(GtkWidget* widget) {
+ if (widget == del_history_checkbox_) {
+ profile_->GetPrefs()->SetBoolean(prefs::kDeleteBrowsingHistory,
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)) ?
+ true : false);
+ } else if (widget == del_downloads_checkbox_) {
+ profile_->GetPrefs()->SetBoolean(prefs::kDeleteDownloadHistory,
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)) ?
+ true : false);
+ } else if (widget == del_cache_checkbox_) {
+ profile_->GetPrefs()->SetBoolean(prefs::kDeleteCache,
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)) ?
+ true : false);
+ } else if (widget == del_cookies_checkbox_) {
+ profile_->GetPrefs()->SetBoolean(prefs::kDeleteCookies,
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)) ?
+ true : false);
+ } else if (widget == del_passwords_checkbox_) {
+ profile_->GetPrefs()->SetBoolean(prefs::kDeletePasswords,
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)) ?
+ true : false);
+ } else if (widget == del_form_data_checkbox_) {
+ profile_->GetPrefs()->SetBoolean(prefs::kDeleteFormData,
+ 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
new file mode 100644
index 0000000..eddc8bb
--- /dev/null
+++ b/chrome/browser/gtk/clear_browsing_data_dialog_gtk.h
@@ -0,0 +1,57 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_GTK_CLEAR_BROWSING_DATA_DIALOG_GTK_H_
+#define CHROME_BROWSER_GTK_CLEAR_BROWSING_DATA_DIALOG_GTK_H_
+
+#include "chrome/browser/browsing_data_remover.h"
+
+class Profile;
+typedef struct _GtkWindow GtkWindow;
+
+class ClearBrowsingDataDialogGtk {
+ public:
+ // Displays the dialog box to clear browsing data from |profile|.
+ static void Show(GtkWindow* parent, Profile* profile);
+
+ private:
+ ClearBrowsingDataDialogGtk(GtkWindow* parent, Profile* profile);
+ ~ClearBrowsingDataDialogGtk() { }
+
+ // Handler to respond to Ok and Cancel responses from the dialog.
+ static void HandleOnResponseDialog(GtkWidget* widget,
+ int response,
+ ClearBrowsingDataDialogGtk* user_data) {
+ user_data->OnDialogResponse(widget, response);
+ }
+
+ // Handler to respond to widget clicked actions from the dialog.
+ static void HandleOnClickedWidget(GtkWidget* widget,
+ ClearBrowsingDataDialogGtk* user_data) {
+ user_data->OnDialogWidgetClicked(widget);
+ }
+ void OnDialogResponse(GtkWidget* widget, int response);
+ void OnDialogWidgetClicked(GtkWidget* widget);
+
+ // UI elements.
+ GtkWidget* del_history_checkbox_;
+ GtkWidget* del_downloads_checkbox_;
+ GtkWidget* del_cache_checkbox_;
+ GtkWidget* del_cookies_checkbox_;
+ GtkWidget* del_passwords_checkbox_;
+ GtkWidget* del_form_data_checkbox_;
+ GtkWidget* time_period_combobox_;
+
+ // Our current profile.
+ Profile* profile_;
+
+ // If non-null it means removal is in progress. BrowsingDataRemover takes care
+ // of deleting itself when done.
+ BrowsingDataRemover* remover_;
+
+ DISALLOW_COPY_AND_ASSIGN(ClearBrowsingDataDialogGtk);
+};
+
+
+#endif // CHROME_BROWSER_GTK_CLEAR_BROWSING_DATA_DIALOG_GTK_H_
diff --git a/chrome/browser/views/clear_browsing_data.cc b/chrome/browser/views/clear_browsing_data.cc
index 1b4f517..865ba21 100644
--- a/chrome/browser/views/clear_browsing_data.cc
+++ b/chrome/browser/views/clear_browsing_data.cc
@@ -19,9 +19,6 @@
#include "views/standard_layout.h"
#include "views/window/window.h"
-using base::Time;
-using base::TimeDelta;
-
// The combo box is vertically aligned to the 'time-period' label, which makes
// the combo box look a little too close to the check box above it when we use
// standard layout to separate them. We therefore add a little extra margin to
@@ -399,19 +396,7 @@ static bool IsCheckBoxEnabledAndSelected(views::Checkbox* cb) {
}
void ClearBrowsingDataView::OnDelete() {
- TimeDelta diff;
- Time delete_begin = Time::Now();
-
int period_selected = time_period_combobox_->GetSelectedItem();
- switch (period_selected) {
- case 0: diff = TimeDelta::FromHours(24); break; // Last day.
- case 1: diff = TimeDelta::FromHours(7*24); break; // Last week.
- case 2: diff = TimeDelta::FromHours(4*7*24); break; // Four weeks.
- case 3: delete_begin = Time(); break; // Everything.
- default: NOTREACHED() << L"Missing item"; break;
- }
-
- delete_begin = delete_begin - diff;
int remove_mask = 0;
if (IsCheckBoxEnabledAndSelected(del_history_checkbox_))
@@ -431,8 +416,9 @@ void ClearBrowsingDataView::OnDelete() {
UpdateControlEnabledState();
// BrowsingDataRemover deletes itself when done.
- remover_ =
- new BrowsingDataRemover(profile_, delete_begin, Time());
+ remover_ = new BrowsingDataRemover(profile_,
+ static_cast<BrowsingDataRemover::TimePeriod>(period_selected),
+ base::Time());
remover_->AddObserver(this);
remover_->Remove(remove_mask);
}
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp
index 092fcb3..3458ec2 100644
--- a/chrome/chrome.gyp
+++ b/chrome/chrome.gyp
@@ -875,6 +875,8 @@
'browser/gtk/browser_window_factory_gtk.cc',
'browser/gtk/browser_window_gtk.cc',
'browser/gtk/browser_window_gtk.h',
+ 'browser/gtk/clear_browsing_data_dialog_gtk.cc',
+ 'browser/gtk/clear_browsing_data_dialog_gtk.h',
'browser/gtk/custom_button.cc',
'browser/gtk/custom_button.h',
'browser/gtk/dialogs_gtk.cc',