| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/tracing/tracing_ui.h" | 5 #include "content/browser/tracing/tracing_ui.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 trace_data_sink->AddMetadata(metadata_dict); | 162 trace_data_sink->AddMetadata(metadata_dict); |
| 163 } | 163 } |
| 164 | 164 |
| 165 bool OnBeginJSONRequest(const std::string& path, | 165 bool OnBeginJSONRequest(const std::string& path, |
| 166 const WebUIDataSource::GotDataCallback& callback) { | 166 const WebUIDataSource::GotDataCallback& callback) { |
| 167 if (path == "json/categories") { | 167 if (path == "json/categories") { |
| 168 return TracingController::GetInstance()->GetCategories( | 168 return TracingController::GetInstance()->GetCategories( |
| 169 base::Bind(OnGotCategories, callback)); | 169 base::Bind(OnGotCategories, callback)); |
| 170 } | 170 } |
| 171 | 171 |
| 172 const char* beginRecordingPath = "json/begin_recording?"; | 172 const char kBeginRecordingPath[] = "json/begin_recording?"; |
| 173 if (base::StartsWith(path, beginRecordingPath, | 173 if (base::StartsWith(path, kBeginRecordingPath, |
| 174 base::CompareCase::SENSITIVE)) { | 174 base::CompareCase::SENSITIVE)) { |
| 175 std::string data = path.substr(strlen(beginRecordingPath)); | 175 std::string data = path.substr(strlen(kBeginRecordingPath)); |
| 176 return BeginRecording(data, callback); | 176 return BeginRecording(data, callback); |
| 177 } | 177 } |
| 178 if (path == "json/get_buffer_percent_full") { | 178 if (path == "json/get_buffer_percent_full") { |
| 179 return TracingController::GetInstance()->GetTraceBufferUsage( | 179 return TracingController::GetInstance()->GetTraceBufferUsage( |
| 180 base::Bind(OnTraceBufferUsageResult, callback)); | 180 base::Bind(OnTraceBufferUsageResult, callback)); |
| 181 } | 181 } |
| 182 if (path == "json/get_buffer_status") { | 182 if (path == "json/get_buffer_status") { |
| 183 return TracingController::GetInstance()->GetTraceBufferUsage( | 183 return TracingController::GetInstance()->GetTraceBufferUsage( |
| 184 base::Bind(OnTraceBufferStatusResult, callback)); | 184 base::Bind(OnTraceBufferStatusResult, callback)); |
| 185 } | 185 } |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 web_ui()->CallJavascriptFunction("onUploadComplete", | 317 web_ui()->CallJavascriptFunction("onUploadComplete", |
| 318 base::StringValue(feedback)); | 318 base::StringValue(feedback)); |
| 319 } else { | 319 } else { |
| 320 web_ui()->CallJavascriptFunction("onUploadError", | 320 web_ui()->CallJavascriptFunction("onUploadError", |
| 321 base::StringValue(feedback)); | 321 base::StringValue(feedback)); |
| 322 } | 322 } |
| 323 trace_uploader_.reset(); | 323 trace_uploader_.reset(); |
| 324 } | 324 } |
| 325 | 325 |
| 326 } // namespace content | 326 } // namespace content |
| OLD | NEW |