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

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

Issue 16294003: Update content/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 6 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/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 // 150 //
151 //////////////////////////////////////////////////////////////////////////////// 151 ////////////////////////////////////////////////////////////////////////////////
152 152
153 TracingMessageHandler::TracingMessageHandler() 153 TracingMessageHandler::TracingMessageHandler()
154 : select_trace_file_dialog_type_(ui::SelectFileDialog::SELECT_NONE), 154 : select_trace_file_dialog_type_(ui::SelectFileDialog::SELECT_NONE),
155 trace_enabled_(false), 155 trace_enabled_(false),
156 system_trace_in_progress_(false) { 156 system_trace_in_progress_(false) {
157 } 157 }
158 158
159 TracingMessageHandler::~TracingMessageHandler() { 159 TracingMessageHandler::~TracingMessageHandler() {
160 if (select_trace_file_dialog_) 160 if (select_trace_file_dialog_.get())
161 select_trace_file_dialog_->ListenerDestroyed(); 161 select_trace_file_dialog_->ListenerDestroyed();
162 162
163 // If we are the current subscriber, this will result in ending tracing. 163 // If we are the current subscriber, this will result in ending tracing.
164 TraceController::GetInstance()->CancelSubscriber(this); 164 TraceController::GetInstance()->CancelSubscriber(this);
165 165
166 // Shutdown any system tracing too. 166 // Shutdown any system tracing too.
167 if (system_trace_in_progress_) { 167 if (system_trace_in_progress_) {
168 #if defined(OS_CHROMEOS) 168 #if defined(OS_CHROMEOS)
169 chromeos::DBusThreadManager::Get()->GetDebugDaemonClient()-> 169 chromeos::DBusThreadManager::Get()->GetDebugDaemonClient()->
170 RequestStopSystemTracing( 170 RequestStopSystemTracing(
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 web_ui()->CallJavascriptFunction( 303 web_ui()->CallJavascriptFunction(
304 "tracingController.onLoadTraceFileCanceled"); 304 "tracingController.onLoadTraceFileCanceled");
305 } else { 305 } else {
306 web_ui()->CallJavascriptFunction( 306 web_ui()->CallJavascriptFunction(
307 "tracingController.onSaveTraceFileCanceled"); 307 "tracingController.onSaveTraceFileCanceled");
308 } 308 }
309 } 309 }
310 310
311 void TracingMessageHandler::OnLoadTraceFile(const base::ListValue* list) { 311 void TracingMessageHandler::OnLoadTraceFile(const base::ListValue* list) {
312 // Only allow a single dialog at a time. 312 // Only allow a single dialog at a time.
313 if (select_trace_file_dialog_) 313 if (select_trace_file_dialog_.get())
314 return; 314 return;
315 select_trace_file_dialog_type_ = ui::SelectFileDialog::SELECT_OPEN_FILE; 315 select_trace_file_dialog_type_ = ui::SelectFileDialog::SELECT_OPEN_FILE;
316 select_trace_file_dialog_ = ui::SelectFileDialog::Create( 316 select_trace_file_dialog_ = ui::SelectFileDialog::Create(
317 this, 317 this,
318 GetContentClient()->browser()->CreateSelectFilePolicy( 318 GetContentClient()->browser()->CreateSelectFilePolicy(
319 web_ui()->GetWebContents())); 319 web_ui()->GetWebContents()));
320 select_trace_file_dialog_->SelectFile( 320 select_trace_file_dialog_->SelectFile(
321 ui::SelectFileDialog::SELECT_OPEN_FILE, 321 ui::SelectFileDialog::SELECT_OPEN_FILE,
322 string16(), 322 string16(),
323 base::FilePath(), 323 base::FilePath(),
(...skipping 29 matching lines...) Expand all
353 // The CallJavascriptFunction is not used because we need to pass 353 // The CallJavascriptFunction is not used because we need to pass
354 // the first param |window.traceData| through as an un-quoted string. 354 // the first param |window.traceData| through as an un-quoted string.
355 rvh->ExecuteJavascriptInWebFrame(string16(), UTF8ToUTF16( 355 rvh->ExecuteJavascriptInWebFrame(string16(), UTF8ToUTF16(
356 "tracingController.onLoadTraceFileComplete(window.traceData," + 356 "tracingController.onLoadTraceFileComplete(window.traceData," +
357 base::GetDoubleQuotedJson(path.value()) + ");" + 357 base::GetDoubleQuotedJson(path.value()) + ");" +
358 "delete window.traceData;")); 358 "delete window.traceData;"));
359 } 359 }
360 360
361 void TracingMessageHandler::OnSaveTraceFile(const base::ListValue* list) { 361 void TracingMessageHandler::OnSaveTraceFile(const base::ListValue* list) {
362 // Only allow a single dialog at a time. 362 // Only allow a single dialog at a time.
363 if (select_trace_file_dialog_) 363 if (select_trace_file_dialog_.get())
364 return; 364 return;
365 365
366 DCHECK(list->GetSize() == 1); 366 DCHECK(list->GetSize() == 1);
367 367
368 std::string* trace_data = new std::string(); 368 std::string* trace_data = new std::string();
369 bool ok = list->GetString(0, trace_data); 369 bool ok = list->GetString(0, trace_data);
370 DCHECK(ok); 370 DCHECK(ok);
371 trace_data_to_save_.reset(trace_data); 371 trace_data_to_save_.reset(trace_data);
372 372
373 select_trace_file_dialog_type_ = ui::SelectFileDialog::SELECT_SAVEAS_FILE; 373 select_trace_file_dialog_type_ = ui::SelectFileDialog::SELECT_SAVEAS_FILE;
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 TracingUI::TracingUI(WebUI* web_ui) : WebUIController(web_ui) { 552 TracingUI::TracingUI(WebUI* web_ui) : WebUIController(web_ui) {
553 web_ui->AddMessageHandler(new TracingMessageHandler()); 553 web_ui->AddMessageHandler(new TracingMessageHandler());
554 554
555 // Set up the chrome://tracing/ source. 555 // Set up the chrome://tracing/ source.
556 BrowserContext* browser_context = 556 BrowserContext* browser_context =
557 web_ui->GetWebContents()->GetBrowserContext(); 557 web_ui->GetWebContents()->GetBrowserContext();
558 WebUIDataSource::Add(browser_context, CreateTracingHTMLSource()); 558 WebUIDataSource::Add(browser_context, CreateTracingHTMLSource());
559 } 559 }
560 560
561 } // namespace content 561 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/streams/stream_url_request_job_unittest.cc ('k') | content/browser/web_contents/interstitial_page_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698