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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 141 } | 141 } |
| 142 | 142 |
| 143 void WebRtcLogsDOMHandler::UpdateUI() { | 143 void WebRtcLogsDOMHandler::UpdateUI() { |
| 144 std::vector<UploadList::UploadInfo> uploads; | 144 std::vector<UploadList::UploadInfo> uploads; |
| 145 upload_list_->GetUploads(50, &uploads); | 145 upload_list_->GetUploads(50, &uploads); |
| 146 | 146 |
| 147 base::ListValue upload_list; | 147 base::ListValue upload_list; |
| 148 for (std::vector<UploadList::UploadInfo>::iterator i = uploads.begin(); | 148 for (std::vector<UploadList::UploadInfo>::iterator i = uploads.begin(); |
| 149 i != uploads.end(); | 149 i != uploads.end(); |
| 150 ++i) { | 150 ++i) { |
| 151 base::DictionaryValue* upload = new base::DictionaryValue(); | 151 base::DictionaryValue* upload = new base::DictionaryValue(); |
|
Evan Stade
2015/10/16 16:37:20
can you make this a scoped_ptr
Henrik Grunell
2015/10/19 10:53:24
Done.
| |
| 152 upload->SetString("id", i->id); | 152 upload->SetString("id", i->upload_id); |
| 153 | 153 |
| 154 base::string16 value_w; | 154 base::string16 value_w; |
| 155 if (!i->time.is_null()) | 155 if (!i->upload_time.is_null()) |
| 156 value_w = base::TimeFormatFriendlyDateAndTime(i->time); | 156 value_w = base::TimeFormatFriendlyDateAndTime(i->upload_time); |
| 157 upload->SetString("upload_time", value_w); | 157 upload->SetString("upload_time", value_w); |
| 158 | 158 |
| 159 value_w.clear(); | 159 value_w.clear(); |
| 160 double seconds_since_epoch; | 160 if (!i->capture_time.is_null()) { |
| 161 if (base::StringToDouble(i->local_id, &seconds_since_epoch)) { | 161 value_w = base::TimeFormatFriendlyDateAndTime(i->capture_time); |
|
Evan Stade
2015/10/16 16:37:20
nit: no curlies
Henrik Grunell
2015/10/19 10:53:24
Done.
| |
| 162 base::Time capture_time = base::Time::FromDoubleT(seconds_since_epoch); | |
| 163 value_w = base::TimeFormatFriendlyDateAndTime(capture_time); | |
| 164 } | 162 } |
| 165 upload->SetString("capture_time", value_w); | 163 upload->SetString("capture_time", value_w); |
| 166 | 164 |
| 167 base::FilePath::StringType value; | 165 base::FilePath::StringType value; |
| 168 if (!i->local_id.empty()) | 166 if (!i->local_id.empty()) |
| 169 value = log_dir_.AppendASCII(i->local_id) | 167 value = log_dir_.AppendASCII(i->local_id) |
| 170 .AddExtension(FILE_PATH_LITERAL(".gz")).value(); | 168 .AddExtension(FILE_PATH_LITERAL(".gz")).value(); |
| 171 upload->SetString("local_file", value); | 169 upload->SetString("local_file", value); |
| 172 | 170 |
| 173 upload_list.Append(upload); | 171 upload_list.Append(upload); |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 187 // | 185 // |
| 188 /////////////////////////////////////////////////////////////////////////////// | 186 /////////////////////////////////////////////////////////////////////////////// |
| 189 | 187 |
| 190 WebRtcLogsUI::WebRtcLogsUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 188 WebRtcLogsUI::WebRtcLogsUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
| 191 Profile* profile = Profile::FromWebUI(web_ui); | 189 Profile* profile = Profile::FromWebUI(web_ui); |
| 192 web_ui->AddMessageHandler(new WebRtcLogsDOMHandler(profile)); | 190 web_ui->AddMessageHandler(new WebRtcLogsDOMHandler(profile)); |
| 193 | 191 |
| 194 // Set up the chrome://webrtc-logs/ source. | 192 // Set up the chrome://webrtc-logs/ source. |
| 195 content::WebUIDataSource::Add(profile, CreateWebRtcLogsUIHTMLSource()); | 193 content::WebUIDataSource::Add(profile, CreateWebRtcLogsUIHTMLSource()); |
| 196 } | 194 } |
| OLD | NEW |