| Index: chrome/browser/ui/webui/media/webrtc_logs_ui.cc
|
| diff --git a/chrome/browser/ui/webui/media/webrtc_logs_ui.cc b/chrome/browser/ui/webui/media/webrtc_logs_ui.cc
|
| index 37ab6fe51bbe42a3d425011c20c71c08df84d05d..fab1fbe2b9093aa6516a7de8da56eee91d26b343 100644
|
| --- a/chrome/browser/ui/webui/media/webrtc_logs_ui.cc
|
| +++ b/chrome/browser/ui/webui/media/webrtc_logs_ui.cc
|
| @@ -11,6 +11,7 @@
|
| #include "base/i18n/time_formatting.h"
|
| #include "base/memory/ref_counted_memory.h"
|
| #include "base/prefs/pref_service.h"
|
| +#include "base/strings/string16.h"
|
| #include "base/strings/string_number_conversions.h"
|
| #include "base/strings/utf_string_conversions.h"
|
| #include "base/values.h"
|
| @@ -148,29 +149,50 @@ void WebRtcLogsDOMHandler::UpdateUI() {
|
| for (std::vector<UploadList::UploadInfo>::iterator i = uploads.begin();
|
| i != uploads.end();
|
| ++i) {
|
| - base::DictionaryValue* upload = new base::DictionaryValue();
|
| - upload->SetString("id", i->id);
|
| + scoped_ptr<base::DictionaryValue> upload(new base::DictionaryValue());
|
| + upload->SetString("id", i->upload_id);
|
|
|
| base::string16 value_w;
|
| - if (!i->time.is_null())
|
| - value_w = base::TimeFormatFriendlyDateAndTime(i->time);
|
| + if (!i->upload_time.is_null())
|
| + value_w = base::TimeFormatFriendlyDateAndTime(i->upload_time);
|
| upload->SetString("upload_time", value_w);
|
|
|
| - value_w.clear();
|
| - double seconds_since_epoch;
|
| - if (base::StringToDouble(i->local_id, &seconds_since_epoch)) {
|
| - base::Time capture_time = base::Time::FromDoubleT(seconds_since_epoch);
|
| - value_w = base::TimeFormatFriendlyDateAndTime(capture_time);
|
| - }
|
| - upload->SetString("capture_time", value_w);
|
| -
|
| base::FilePath::StringType value;
|
| if (!i->local_id.empty())
|
| value = log_dir_.AppendASCII(i->local_id)
|
| .AddExtension(FILE_PATH_LITERAL(".gz")).value();
|
| upload->SetString("local_file", value);
|
|
|
| - upload_list.Append(upload);
|
| + // In october 2015, capture time was added to the log list, previously the
|
| + // local ID was used as capture time. The local ID has however changed so
|
| + // that it might not be a time. We fall back on the local ID if it traslates
|
| + // to a time within reasonable bounds, otherwise we fall back on the upload
|
| + // time.
|
| + // TODO(grunell): Use |capture_time| only.
|
| + if (!i->capture_time.is_null()) {
|
| + value_w = base::TimeFormatFriendlyDateAndTime(i->capture_time);
|
| + } else {
|
| + // Fall back on local ID as time. We need to check that it's within
|
| + // resonable bounds, since the ID may not represent time. Check between
|
| + // 2012 when the feature was introduced and now.
|
| + double seconds_since_epoch;
|
| + if (base::StringToDouble(i->local_id, &seconds_since_epoch)) {
|
| + base::Time capture_time = base::Time::FromDoubleT(seconds_since_epoch);
|
| + base::Time::Exploded lower_limit = {2012, 1, 0, 1, 0, 0, 0, 0};
|
| + if (capture_time > base::Time::FromUTCExploded(lower_limit) &&
|
| + capture_time < base::Time::Now()) {
|
| + value_w = base::TimeFormatFriendlyDateAndTime(capture_time);
|
| + }
|
| + }
|
| + }
|
| + // If we haven't set |value_w| above, we fall back on the upload time, which
|
| + // was already in the variable. In case it's empty set the string to
|
| + // inform that the time is unknown.
|
| + if (value_w.empty())
|
| + value_w = base::string16(base::ASCIIToUTF16("(unknown time)"));
|
| + upload->SetString("capture_time", value_w);
|
| +
|
| + upload_list.Append(upload.Pass());
|
| }
|
|
|
| base::StringValue version(version_info::GetVersionNumber());
|
|
|