Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Side by Side Diff: components/crash/core/browser/crashes_ui_util.cc

Issue 2612993003: Display both capture and upload times in chrome://crashes. (Closed)
Patch Set: Handle Breakpad reports (with no capture_time) correctly. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | components/crash/core/browser/resources/crashes.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 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 "components/crash/core/browser/crashes_ui_util.h" 5 #include "components/crash/core/browser/crashes_ui_util.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/i18n/time_formatting.h" 11 #include "base/i18n/time_formatting.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "components/upload_list/upload_list.h" 14 #include "components/upload_list/upload_list.h"
15 #include "grit/components_chromium_strings.h" 15 #include "grit/components_chromium_strings.h"
16 #include "grit/components_strings.h" 16 #include "grit/components_strings.h"
17 17
18 namespace crash { 18 namespace crash {
19 19
20 const CrashesUILocalizedString kCrashesUILocalizedStrings[] = { 20 const CrashesUILocalizedString kCrashesUILocalizedStrings[] = {
21 {"bugLinkText", IDS_CRASH_BUG_LINK_LABEL}, 21 {"bugLinkText", IDS_CRASH_BUG_LINK_LABEL},
22 {"crashCountFormat", IDS_CRASH_CRASH_COUNT_BANNER_FORMAT}, 22 {"crashCountFormat", IDS_CRASH_CRASH_COUNT_BANNER_FORMAT},
23 {"crashHeaderFormat", IDS_CRASH_CRASH_HEADER_FORMAT}, 23 {"crashHeaderFormat", IDS_CRASH_CRASH_HEADER_FORMAT},
24 {"crashHeaderFormatLocalOnly", IDS_CRASH_CRASH_HEADER_FORMAT_LOCAL_ONLY}, 24 {"crashHeaderFormatLocalOnly", IDS_CRASH_CRASH_HEADER_FORMAT_LOCAL_ONLY},
25 {"crashTimeFormat", IDS_CRASH_CRASH_TIME_FORMAT}, 25 {"crashUploadTimeFormat", IDS_CRASH_UPLOAD_TIME_FORMAT},
26 {"crashCaptureAndUploadTimeFormat",
27 IDS_CRASH_CAPTURE_AND_UPLOAD_TIME_FORMAT},
26 {"crashNotUploaded", IDS_CRASH_CRASH_NOT_UPLOADED}, 28 {"crashNotUploaded", IDS_CRASH_CRASH_NOT_UPLOADED},
27 {"crashUserRequested", IDS_CRASH_CRASH_USER_REQUESTED}, 29 {"crashUserRequested", IDS_CRASH_CRASH_USER_REQUESTED},
28 {"crashPending", IDS_CRASH_CRASH_PENDING}, 30 {"crashPending", IDS_CRASH_CRASH_PENDING},
29 {"crashesTitle", IDS_CRASH_TITLE}, 31 {"crashesTitle", IDS_CRASH_TITLE},
30 {"disabledHeader", IDS_CRASH_DISABLED_HEADER}, 32 {"disabledHeader", IDS_CRASH_DISABLED_HEADER},
31 {"disabledMessage", IDS_CRASH_DISABLED_MESSAGE}, 33 {"disabledMessage", IDS_CRASH_DISABLED_MESSAGE},
32 {"noCrashesMessage", IDS_CRASH_NO_CRASHES_MESSAGE}, 34 {"noCrashesMessage", IDS_CRASH_NO_CRASHES_MESSAGE},
33 {"uploadCrashesLinkText", IDS_CRASH_UPLOAD_MESSAGE}, 35 {"uploadCrashesLinkText", IDS_CRASH_UPLOAD_MESSAGE},
34 {"uploadNowLinkText", IDS_CRASH_UPLOAD_NOW_LINK_TEXT}, 36 {"uploadNowLinkText", IDS_CRASH_UPLOAD_NOW_LINK_TEXT},
35 {"crashSizeMessage", IDS_CRASH_SIZE_MESSAGE}, 37 {"crashSizeMessage", IDS_CRASH_SIZE_MESSAGE},
(...skipping 26 matching lines...) Expand all
62 } 64 }
63 65
64 void UploadListToValue(UploadList* upload_list, base::ListValue* out_value) { 66 void UploadListToValue(UploadList* upload_list, base::ListValue* out_value) {
65 std::vector<UploadList::UploadInfo> crashes; 67 std::vector<UploadList::UploadInfo> crashes;
66 upload_list->GetUploads(50, &crashes); 68 upload_list->GetUploads(50, &crashes);
67 69
68 for (const auto& info : crashes) { 70 for (const auto& info : crashes) {
69 std::unique_ptr<base::DictionaryValue> crash(new base::DictionaryValue()); 71 std::unique_ptr<base::DictionaryValue> crash(new base::DictionaryValue());
70 crash->SetString("id", info.upload_id); 72 crash->SetString("id", info.upload_id);
71 if (info.state == UploadList::UploadInfo::State::Uploaded) { 73 if (info.state == UploadList::UploadInfo::State::Uploaded) {
72 crash->SetString("time", 74 crash->SetString("upload_time",
73 base::TimeFormatFriendlyDateAndTime(info.upload_time)); 75 base::TimeFormatFriendlyDateAndTime(info.upload_time));
74 } else { 76 }
75 crash->SetString("time", 77 if (!info.capture_time.is_null()) {
78 crash->SetString("capture_time",
76 base::TimeFormatFriendlyDateAndTime(info.capture_time)); 79 base::TimeFormatFriendlyDateAndTime(info.capture_time));
77 } 80 }
78 crash->SetString("local_id", info.local_id); 81 crash->SetString("local_id", info.local_id);
79 crash->SetString("state", UploadInfoStateAsString(info.state)); 82 crash->SetString("state", UploadInfoStateAsString(info.state));
80 crash->SetString("file_size", info.file_size); 83 crash->SetString("file_size", info.file_size);
81 out_value->Append(std::move(crash)); 84 out_value->Append(std::move(crash));
82 } 85 }
83 } 86 }
84 87
85 } // namespace crash 88 } // namespace crash
OLDNEW
« no previous file with comments | « no previous file | components/crash/core/browser/resources/crashes.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698