| 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 <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 // Set up the chrome://tracing/ source. | 236 // Set up the chrome://tracing/ source. |
| 237 BrowserContext* browser_context = | 237 BrowserContext* browser_context = |
| 238 web_ui->GetWebContents()->GetBrowserContext(); | 238 web_ui->GetWebContents()->GetBrowserContext(); |
| 239 | 239 |
| 240 WebUIDataSource* source = WebUIDataSource::Create(kChromeUITracingHost); | 240 WebUIDataSource* source = WebUIDataSource::Create(kChromeUITracingHost); |
| 241 source->SetJsonPath("strings.js"); | 241 source->SetJsonPath("strings.js"); |
| 242 source->SetDefaultResource(IDR_TRACING_HTML); | 242 source->SetDefaultResource(IDR_TRACING_HTML); |
| 243 source->AddResourcePath("tracing.js", IDR_TRACING_JS); | 243 source->AddResourcePath("tracing.js", IDR_TRACING_JS); |
| 244 source->SetRequestFilter(base::Bind(OnTracingRequest)); | 244 source->SetRequestFilter(base::Bind(OnTracingRequest)); |
| 245 WebUIDataSource::Add(browser_context, source); | 245 WebUIDataSource::Add(browser_context, source); |
| 246 TracingController::GetInstance()->RegisterTracingUI(this); |
| 247 } |
| 248 |
| 249 TracingUI::~TracingUI() { |
| 250 TracingController::GetInstance()->UnregisterTracingUI(this); |
| 251 } |
| 252 |
| 253 void TracingUI::OnMonitoringStateChanged(bool is_monitoring) { |
| 254 web_ui()->CallJavascriptFunction( |
| 255 "onMonitoringStateChanged", base::FundamentalValue(is_monitoring)); |
| 246 } | 256 } |
| 247 | 257 |
| 248 } // namespace content | 258 } // namespace content |
| OLD | NEW |