Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(507)

Side by Side Diff: content/browser/tracing/tracing_ui.cc

Issue 127703002: Add a mechanism to let TracingController invoke JavaScript via TracingUI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698