OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "components/crash/core/browser/crashes_ui_util.h" |
| 6 |
| 7 #include <vector> |
| 8 |
| 9 #include "base/i18n/time_formatting.h" |
| 10 #include "base/macros.h" |
| 11 #include "base/values.h" |
| 12 #include "components/upload_list/upload_list.h" |
| 13 #include "grit/components_chromium_strings.h" |
| 14 #include "grit/components_google_chrome_strings.h" |
| 15 #include "grit/components_strings.h" |
| 16 |
| 17 namespace crash { |
| 18 |
| 19 const CrashesUILocalizedString kCrashesUILocalizedStrings[] = { |
| 20 {"bugLinkText", IDS_CRASH_BUG_LINK_LABEL}, |
| 21 {"crashCountFormat", IDS_CRASH_CRASH_COUNT_BANNER_FORMAT}, |
| 22 {"crashHeaderFormat", IDS_CRASH_CRASH_HEADER_FORMAT}, |
| 23 {"crashTimeFormat", IDS_CRASH_CRASH_TIME_FORMAT}, |
| 24 {"crashesTitle", IDS_CRASH_TITLE}, |
| 25 {"disabledHeader", IDS_CRASH_DISABLED_HEADER}, |
| 26 {"disabledMessage", IDS_CRASH_DISABLED_MESSAGE}, |
| 27 {"noCrashesMessage", IDS_CRASH_NO_CRASHES_MESSAGE}, |
| 28 {"uploadCrashesLinkText", IDS_CRASH_UPLOAD_MESSAGE}, |
| 29 }; |
| 30 |
| 31 const size_t kCrashesUILocalizedStringsCount = |
| 32 arraysize(kCrashesUILocalizedStrings); |
| 33 |
| 34 const char kCrashesUICrashesJS[] = "crashes.js"; |
| 35 const char kCrashesUIRequestCrashList[] = "requestCrashList"; |
| 36 const char kCrashesUIRequestCrashUpload[] = "requestCrashUpload"; |
| 37 const char kCrashesUIShortProductName[] = "shortProductName"; |
| 38 const char kCrashesUIUpdateCrashList[] = "updateCrashList"; |
| 39 |
| 40 void UploadListToValue(UploadList* upload_list, base::ListValue* out_value) { |
| 41 std::vector<UploadList::UploadInfo> crashes; |
| 42 upload_list->GetUploads(50, &crashes); |
| 43 |
| 44 for (const auto& info : crashes) { |
| 45 base::DictionaryValue* crash = new base::DictionaryValue(); |
| 46 crash->SetString("id", info.id); |
| 47 crash->SetString("time", base::TimeFormatFriendlyDateAndTime(info.time)); |
| 48 crash->SetString("local_id", info.local_id); |
| 49 out_value->Append(crash); |
| 50 } |
| 51 } |
| 52 |
| 53 } // namespace crash |
OLD | NEW |