Index: chrome/browser/ui/webui/options/clear_browser_data_handler.cc |
diff --git a/chrome/browser/ui/webui/options/clear_browser_data_handler.cc b/chrome/browser/ui/webui/options/clear_browser_data_handler.cc |
index 86f658b1bfdd10760705751fd19bcd583841e82b..eb793c7ccbcff7476c759696692f04014b12b02c 100644 |
--- a/chrome/browser/ui/webui/options/clear_browser_data_handler.cc |
+++ b/chrome/browser/ui/webui/options/clear_browser_data_handler.cc |
@@ -21,6 +21,7 @@ |
#include "grit/chromium_strings.h" |
#include "grit/generated_resources.h" |
#include "grit/locale_settings.h" |
+#include "ui/base/accelerators/accelerator.h" |
#include "ui/base/l10n/l10n_util.h" |
namespace { |
@@ -46,6 +47,25 @@ void ClearBrowserDataHandler::InitializeHandler() { |
Profile::FromWebUI(web_ui())->GetPrefs()); |
} |
+void ClearBrowserDataHandler::InitializePage() { |
+ UpdateInfoBannerVisibility(); |
+} |
+ |
+void ClearBrowserDataHandler::UpdateInfoBannerVisibility() { |
+ Profile* profile = Profile::FromWebUI(web_ui()); |
+ base::Time lastClearBrowsingDataTime = base::Time::FromInternalValue( |
+ profile->GetPrefs()->GetInt64(prefs::kLastClearBrowsingDataTime)); |
+ |
+ const int64 kHoursPerDay = 24; |
+ bool visible = (base::Time::Now() - lastClearBrowsingDataTime) <= |
+ base::TimeDelta::FromHours(kHoursPerDay); |
+ |
+ ListValue args; |
+ args.Append(Value::CreateBooleanValue(visible)); |
+ web_ui()->CallJavascriptFunction( |
+ "ClearBrowserDataOverlay.setBannerVisibility", args); |
+} |
+ |
void ClearBrowserDataHandler::GetLocalizedValues( |
DictionaryValue* localized_strings) { |
DCHECK(localized_strings); |
@@ -74,6 +94,13 @@ void ClearBrowserDataHandler::GetLocalizedValues( |
google_util::StringAppendGoogleLocaleParam( |
kClearBrowsingDataLearnMoreUrl)); |
+ ui::Accelerator acc(ui::VKEY_N, ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN); |
+ localized_strings->SetString( |
+ "clearBrowserDataInfoBar", |
+ l10n_util::GetStringFUTF16( |
+ IDS_CLEAR_BROWSING_DATA_INFO_BAR_TEXT, |
+ acc.GetShortcutText())); |
+ |
ListValue* time_list = new ListValue; |
for (int i = 0; i < 5; i++) { |
string16 label_string; |
@@ -152,6 +179,12 @@ void ClearBrowserDataHandler::HandleClearBrowserData(const ListValue* value) { |
static_cast<BrowsingDataRemover::TimePeriod>(period_selected)); |
remover_->AddObserver(this); |
remover_->Remove(remove_mask, origin_mask); |
+ |
+ // Store the clear browsing data time. Next time the clear browsing data |
+ // dialog is open, this time is used to decide whether to display an info |
+ // banner or not. |
+ prefs->SetInt64(prefs::kLastClearBrowsingDataTime, |
+ base::Time::Now().ToInternalValue()); |
} |
void ClearBrowserDataHandler::OnBrowsingDataRemoverDone() { |