| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/webui/options/clear_browser_data_handler.h" | 5 #include "chrome/browser/ui/webui/options/clear_browser_data_handler.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 void ClearBrowserDataHandler::UpdateInfoBannerVisibility() { | 66 void ClearBrowserDataHandler::UpdateInfoBannerVisibility() { |
| 67 Profile* profile = Profile::FromWebUI(web_ui()); | 67 Profile* profile = Profile::FromWebUI(web_ui()); |
| 68 base::Time lastClearBrowsingDataTime = base::Time::FromInternalValue( | 68 base::Time lastClearBrowsingDataTime = base::Time::FromInternalValue( |
| 69 profile->GetPrefs()->GetInt64(prefs::kLastClearBrowsingDataTime)); | 69 profile->GetPrefs()->GetInt64(prefs::kLastClearBrowsingDataTime)); |
| 70 | 70 |
| 71 const int64 kHoursPerDay = 24; | 71 const int64 kHoursPerDay = 24; |
| 72 bool visible = (base::Time::Now() - lastClearBrowsingDataTime) <= | 72 bool visible = (base::Time::Now() - lastClearBrowsingDataTime) <= |
| 73 base::TimeDelta::FromHours(kHoursPerDay); | 73 base::TimeDelta::FromHours(kHoursPerDay); |
| 74 | 74 |
| 75 base::ListValue args; | 75 base::ListValue args; |
| 76 args.Append(base::Value::CreateBooleanValue(visible)); | 76 args.AppendBoolean(visible); |
| 77 web_ui()->CallJavascriptFunction( | 77 web_ui()->CallJavascriptFunction( |
| 78 "ClearBrowserDataOverlay.setBannerVisibility", args); | 78 "ClearBrowserDataOverlay.setBannerVisibility", args); |
| 79 } | 79 } |
| 80 | 80 |
| 81 void ClearBrowserDataHandler::GetLocalizedValues( | 81 void ClearBrowserDataHandler::GetLocalizedValues( |
| 82 base::DictionaryValue* localized_strings) { | 82 base::DictionaryValue* localized_strings) { |
| 83 DCHECK(localized_strings); | 83 DCHECK(localized_strings); |
| 84 | 84 |
| 85 static OptionsStringResource resources[] = { | 85 static OptionsStringResource resources[] = { |
| 86 { "clearBrowserDataLabel", IDS_CLEAR_BROWSING_DATA_LABEL }, | 86 { "clearBrowserDataLabel", IDS_CLEAR_BROWSING_DATA_LABEL }, |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 web_ui()->CallJavascriptFunction("ClearBrowserDataOverlay.doneClearing"); | 214 web_ui()->CallJavascriptFunction("ClearBrowserDataOverlay.doneClearing"); |
| 215 } | 215 } |
| 216 | 216 |
| 217 void ClearBrowserDataHandler::OnBrowsingHistoryPrefChanged() { | 217 void ClearBrowserDataHandler::OnBrowsingHistoryPrefChanged() { |
| 218 web_ui()->CallJavascriptFunction( | 218 web_ui()->CallJavascriptFunction( |
| 219 "ClearBrowserDataOverlay.setAllowDeletingHistory", | 219 "ClearBrowserDataOverlay.setAllowDeletingHistory", |
| 220 base::FundamentalValue(*allow_deleting_browser_history_)); | 220 base::FundamentalValue(*allow_deleting_browser_history_)); |
| 221 } | 221 } |
| 222 | 222 |
| 223 } // namespace options | 223 } // namespace options |
| OLD | NEW |