| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> |
| 9 #include <utility> | 10 #include <utility> |
| 10 | 11 |
| 11 #include "base/bind.h" | 12 #include "base/bind.h" |
| 12 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "base/memory/ptr_util.h" | 15 #include "base/memory/ptr_util.h" |
| 15 #include "base/metrics/histogram_macros.h" | 16 #include "base/metrics/histogram_macros.h" |
| 16 #include "base/metrics/sparse_histogram.h" | 17 #include "base/metrics/sparse_histogram.h" |
| 17 #include "base/strings/string16.h" | 18 #include "base/strings/string16.h" |
| 18 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 case 2: | 209 case 2: |
| 209 label_string = l10n_util::GetStringUTF16(IDS_CLEAR_DATA_WEEK); | 210 label_string = l10n_util::GetStringUTF16(IDS_CLEAR_DATA_WEEK); |
| 210 break; | 211 break; |
| 211 case 3: | 212 case 3: |
| 212 label_string = l10n_util::GetStringUTF16(IDS_CLEAR_DATA_4WEEKS); | 213 label_string = l10n_util::GetStringUTF16(IDS_CLEAR_DATA_4WEEKS); |
| 213 break; | 214 break; |
| 214 case 4: | 215 case 4: |
| 215 label_string = l10n_util::GetStringUTF16(IDS_CLEAR_DATA_EVERYTHING); | 216 label_string = l10n_util::GetStringUTF16(IDS_CLEAR_DATA_EVERYTHING); |
| 216 break; | 217 break; |
| 217 } | 218 } |
| 218 base::ListValue* option = new base::ListValue(); | 219 std::unique_ptr<base::ListValue> option(new base::ListValue()); |
| 219 option->AppendInteger(i); | 220 option->AppendInteger(i); |
| 220 option->AppendString(label_string); | 221 option->AppendString(label_string); |
| 221 time_list->Append(option); | 222 time_list->Append(std::move(option)); |
| 222 } | 223 } |
| 223 localized_strings->Set("clearBrowserDataTimeList", time_list); | 224 localized_strings->Set("clearBrowserDataTimeList", time_list); |
| 224 localized_strings->SetBoolean("showDeleteBrowsingHistoryCheckboxes", | 225 localized_strings->SetBoolean("showDeleteBrowsingHistoryCheckboxes", |
| 225 !Profile::FromWebUI(web_ui())->IsSupervised()); | 226 !Profile::FromWebUI(web_ui())->IsSupervised()); |
| 226 } | 227 } |
| 227 | 228 |
| 228 void ClearBrowserDataHandler::RegisterMessages() { | 229 void ClearBrowserDataHandler::RegisterMessages() { |
| 229 // Setup handlers specific to this panel. | 230 // Setup handlers specific to this panel. |
| 230 web_ui()->RegisterMessageCallback("performClearBrowserData", | 231 web_ui()->RegisterMessageCallback("performClearBrowserData", |
| 231 base::Bind(&ClearBrowserDataHandler::HandleClearBrowserData, | 232 base::Bind(&ClearBrowserDataHandler::HandleClearBrowserData, |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 "History.ClearBrowsingData.HistoryNoticeShownInFooterWhenUpdated", | 424 "History.ClearBrowsingData.HistoryNoticeShownInFooterWhenUpdated", |
| 424 should_show_history_notice_); | 425 should_show_history_notice_); |
| 425 } | 426 } |
| 426 | 427 |
| 427 void ClearBrowserDataHandler::UpdateHistoryDeletionDialog(bool show) { | 428 void ClearBrowserDataHandler::UpdateHistoryDeletionDialog(bool show) { |
| 428 // This is used by OnBrowsingDataRemoverDone (when the deletion finishes). | 429 // This is used by OnBrowsingDataRemoverDone (when the deletion finishes). |
| 429 should_show_history_deletion_dialog_ = show; | 430 should_show_history_deletion_dialog_ = show; |
| 430 } | 431 } |
| 431 | 432 |
| 432 } // namespace options | 433 } // namespace options |
| OLD | NEW |