| 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 <vector> | 8 #include <vector> |
| 8 | 9 |
| 9 #include "base/bind.h" | 10 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
| 11 #include "base/i18n/time_formatting.h" | 12 #include "base/i18n/time_formatting.h" |
| 12 #include "base/macros.h" | 13 #include "base/macros.h" |
| 13 #include "base/memory/ref_counted_memory.h" | 14 #include "base/memory/ref_counted_memory.h" |
| 14 #include "base/prefs/pref_service.h" | 15 #include "base/prefs/pref_service.h" |
| 15 #include "base/strings/string16.h" | 16 #include "base/strings/string16.h" |
| 16 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 } | 188 } |
| 188 } | 189 } |
| 189 } | 190 } |
| 190 // If we haven't set |value_w| above, we fall back on the upload time, which | 191 // If we haven't set |value_w| above, we fall back on the upload time, which |
| 191 // was already in the variable. In case it's empty set the string to | 192 // was already in the variable. In case it's empty set the string to |
| 192 // inform that the time is unknown. | 193 // inform that the time is unknown. |
| 193 if (value_w.empty()) | 194 if (value_w.empty()) |
| 194 value_w = base::string16(base::ASCIIToUTF16("(unknown time)")); | 195 value_w = base::string16(base::ASCIIToUTF16("(unknown time)")); |
| 195 upload->SetString("capture_time", value_w); | 196 upload->SetString("capture_time", value_w); |
| 196 | 197 |
| 197 upload_list.Append(upload.Pass()); | 198 upload_list.Append(std::move(upload)); |
| 198 } | 199 } |
| 199 | 200 |
| 200 base::StringValue version(version_info::GetVersionNumber()); | 201 base::StringValue version(version_info::GetVersionNumber()); |
| 201 | 202 |
| 202 web_ui()->CallJavascriptFunction("updateWebRtcLogsList", upload_list, | 203 web_ui()->CallJavascriptFunction("updateWebRtcLogsList", upload_list, |
| 203 version); | 204 version); |
| 204 } | 205 } |
| 205 | 206 |
| 206 } // namespace | 207 } // namespace |
| 207 | 208 |
| 208 /////////////////////////////////////////////////////////////////////////////// | 209 /////////////////////////////////////////////////////////////////////////////// |
| 209 // | 210 // |
| 210 // WebRtcLogsUI | 211 // WebRtcLogsUI |
| 211 // | 212 // |
| 212 /////////////////////////////////////////////////////////////////////////////// | 213 /////////////////////////////////////////////////////////////////////////////// |
| 213 | 214 |
| 214 WebRtcLogsUI::WebRtcLogsUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 215 WebRtcLogsUI::WebRtcLogsUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
| 215 Profile* profile = Profile::FromWebUI(web_ui); | 216 Profile* profile = Profile::FromWebUI(web_ui); |
| 216 web_ui->AddMessageHandler(new WebRtcLogsDOMHandler(profile)); | 217 web_ui->AddMessageHandler(new WebRtcLogsDOMHandler(profile)); |
| 217 | 218 |
| 218 // Set up the chrome://webrtc-logs/ source. | 219 // Set up the chrome://webrtc-logs/ source. |
| 219 content::WebUIDataSource::Add(profile, CreateWebRtcLogsUIHTMLSource()); | 220 content::WebUIDataSource::Add(profile, CreateWebRtcLogsUIHTMLSource()); |
| 220 } | 221 } |
| OLD | NEW |