| 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 <memory> |    9 #include <memory> | 
|   10 #include <set> |   10 #include <set> | 
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  233       base::Bind(&TracingUI::DoUpload, base::Unretained(this))); |  233       base::Bind(&TracingUI::DoUpload, base::Unretained(this))); | 
|  234   web_ui->RegisterMessageCallback( |  234   web_ui->RegisterMessageCallback( | 
|  235       "doUploadBase64", |  235       "doUploadBase64", | 
|  236       base::Bind(&TracingUI::DoUploadBase64Encoded, base::Unretained(this))); |  236       base::Bind(&TracingUI::DoUploadBase64Encoded, base::Unretained(this))); | 
|  237  |  237  | 
|  238   // Set up the chrome://tracing/ source. |  238   // Set up the chrome://tracing/ source. | 
|  239   BrowserContext* browser_context = |  239   BrowserContext* browser_context = | 
|  240       web_ui->GetWebContents()->GetBrowserContext(); |  240       web_ui->GetWebContents()->GetBrowserContext(); | 
|  241  |  241  | 
|  242   WebUIDataSource* source = WebUIDataSource::Create(kChromeUITracingHost); |  242   WebUIDataSource* source = WebUIDataSource::Create(kChromeUITracingHost); | 
 |  243   std::unordered_set<std::string> exclusions; | 
 |  244   exclusions.insert("json/begin_recording"); | 
 |  245   exclusions.insert("json/categories"); | 
 |  246   exclusions.insert("json/end_recording_compressed"); | 
 |  247   exclusions.insert("json/get_buffer_percent_full"); | 
 |  248   exclusions.insert("json/get_buffer_status"); | 
 |  249   source->UseGzip(exclusions); | 
|  243   source->SetJsonPath("strings.js"); |  250   source->SetJsonPath("strings.js"); | 
|  244   source->SetDefaultResource(IDR_TRACING_HTML); |  251   source->SetDefaultResource(IDR_TRACING_HTML); | 
|  245   source->AddResourcePath("tracing.js", IDR_TRACING_JS); |  252   source->AddResourcePath("tracing.js", IDR_TRACING_JS); | 
|  246   source->SetRequestFilter(base::Bind(OnTracingRequest)); |  253   source->SetRequestFilter(base::Bind(OnTracingRequest)); | 
|  247   WebUIDataSource::Add(browser_context, source); |  254   WebUIDataSource::Add(browser_context, source); | 
|  248   TracingControllerImpl::GetInstance()->RegisterTracingUI(this); |  255   TracingControllerImpl::GetInstance()->RegisterTracingUI(this); | 
|  249 } |  256 } | 
|  250  |  257  | 
|  251 TracingUI::~TracingUI() { |  258 TracingUI::~TracingUI() { | 
|  252   TracingControllerImpl::GetInstance()->UnregisterTracingUI(this); |  259   TracingControllerImpl::GetInstance()->UnregisterTracingUI(this); | 
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  325     web_ui()->CallJavascriptFunctionUnsafe("onUploadComplete", |  332     web_ui()->CallJavascriptFunctionUnsafe("onUploadComplete", | 
|  326                                            base::Value(feedback)); |  333                                            base::Value(feedback)); | 
|  327   } else { |  334   } else { | 
|  328     web_ui()->CallJavascriptFunctionUnsafe("onUploadError", |  335     web_ui()->CallJavascriptFunctionUnsafe("onUploadError", | 
|  329                                            base::Value(feedback)); |  336                                            base::Value(feedback)); | 
|  330   } |  337   } | 
|  331   trace_uploader_.reset(); |  338   trace_uploader_.reset(); | 
|  332 } |  339 } | 
|  333  |  340  | 
|  334 }  // namespace content |  341 }  // namespace content | 
| OLD | NEW |