Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/media/webrtc_logs_ui.h" | 5 #include "chrome/browser/ui/webui/media/webrtc_logs_ui.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 175 if (!i->capture_time.is_null()) { | 175 if (!i->capture_time.is_null()) { |
| 176 value_w = base::TimeFormatFriendlyDateAndTime(i->capture_time); | 176 value_w = base::TimeFormatFriendlyDateAndTime(i->capture_time); |
| 177 } else { | 177 } else { |
| 178 // Fall back on local ID as time. We need to check that it's within | 178 // Fall back on local ID as time. We need to check that it's within |
| 179 // resonable bounds, since the ID may not represent time. Check between | 179 // resonable bounds, since the ID may not represent time. Check between |
| 180 // 2012 when the feature was introduced and now. | 180 // 2012 when the feature was introduced and now. |
| 181 double seconds_since_epoch; | 181 double seconds_since_epoch; |
| 182 if (base::StringToDouble(i->local_id, &seconds_since_epoch)) { | 182 if (base::StringToDouble(i->local_id, &seconds_since_epoch)) { |
| 183 base::Time capture_time = base::Time::FromDoubleT(seconds_since_epoch); | 183 base::Time capture_time = base::Time::FromDoubleT(seconds_since_epoch); |
| 184 base::Time::Exploded lower_limit = {2012, 1, 0, 1, 0, 0, 0, 0}; | 184 base::Time::Exploded lower_limit = {2012, 1, 0, 1, 0, 0, 0, 0}; |
| 185 if (capture_time > base::Time::FromUTCExploded(lower_limit) && | 185 base::Time out_time; |
| 186 capture_time < base::Time::Now()) { | 186 if (base::Time::FromUTCExploded(lower_limit, &out_time)) { |
|
Lei Zhang
2016/07/06 17:44:30
Isn't |lower_limit| a known to be good value that
maksims (do not use this acc)
2016/07/07 05:48:14
Done.
| |
| 187 value_w = base::TimeFormatFriendlyDateAndTime(capture_time); | 187 if (capture_time > out_time && capture_time < base::Time::Now()) { |
| 188 value_w = base::TimeFormatFriendlyDateAndTime(capture_time); | |
| 189 } | |
| 188 } | 190 } |
| 189 } | 191 } |
| 190 } | 192 } |
| 191 // If we haven't set |value_w| above, we fall back on the upload time, which | 193 // If we haven't set |value_w| above, we fall back on the upload time, which |
| 192 // was already in the variable. In case it's empty set the string to | 194 // was already in the variable. In case it's empty set the string to |
| 193 // inform that the time is unknown. | 195 // inform that the time is unknown. |
| 194 if (value_w.empty()) | 196 if (value_w.empty()) |
| 195 value_w = base::string16(base::ASCIIToUTF16("(unknown time)")); | 197 value_w = base::string16(base::ASCIIToUTF16("(unknown time)")); |
| 196 upload->SetString("capture_time", value_w); | 198 upload->SetString("capture_time", value_w); |
| 197 | 199 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 212 // | 214 // |
| 213 /////////////////////////////////////////////////////////////////////////////// | 215 /////////////////////////////////////////////////////////////////////////////// |
| 214 | 216 |
| 215 WebRtcLogsUI::WebRtcLogsUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 217 WebRtcLogsUI::WebRtcLogsUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
| 216 Profile* profile = Profile::FromWebUI(web_ui); | 218 Profile* profile = Profile::FromWebUI(web_ui); |
| 217 web_ui->AddMessageHandler(new WebRtcLogsDOMHandler(profile)); | 219 web_ui->AddMessageHandler(new WebRtcLogsDOMHandler(profile)); |
| 218 | 220 |
| 219 // Set up the chrome://webrtc-logs/ source. | 221 // Set up the chrome://webrtc-logs/ source. |
| 220 content::WebUIDataSource::Add(profile, CreateWebRtcLogsUIHTMLSource()); | 222 content::WebUIDataSource::Add(profile, CreateWebRtcLogsUIHTMLSource()); |
| 221 } | 223 } |
| OLD | NEW |