| 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/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 select_trace_file_dialog_ = ui::SelectFileDialog::Create( | 312 select_trace_file_dialog_ = ui::SelectFileDialog::Create( |
| 313 this, | 313 this, |
| 314 GetContentClient()->browser()->CreateSelectFilePolicy( | 314 GetContentClient()->browser()->CreateSelectFilePolicy( |
| 315 web_ui()->GetWebContents())); | 315 web_ui()->GetWebContents())); |
| 316 select_trace_file_dialog_->SelectFile( | 316 select_trace_file_dialog_->SelectFile( |
| 317 ui::SelectFileDialog::SELECT_OPEN_FILE, | 317 ui::SelectFileDialog::SELECT_OPEN_FILE, |
| 318 string16(), | 318 string16(), |
| 319 base::FilePath(), | 319 base::FilePath(), |
| 320 NULL, | 320 NULL, |
| 321 0, | 321 0, |
| 322 FILE_PATH_LITERAL(std::string()), | 322 base::FilePath::StringType(), |
| 323 web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(), | 323 web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(), |
| 324 NULL); | 324 NULL); |
| 325 } | 325 } |
| 326 | 326 |
| 327 void TracingMessageHandler::LoadTraceFileComplete(string16* contents) { | 327 void TracingMessageHandler::LoadTraceFileComplete(string16* contents) { |
| 328 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 328 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 329 | 329 |
| 330 // We need to pass contents to tracingController.onLoadTraceFileComplete, but | 330 // We need to pass contents to tracingController.onLoadTraceFileComplete, but |
| 331 // that may be arbitrarily big, and IPCs messages are limited in size. So we | 331 // that may be arbitrarily big, and IPCs messages are limited in size. So we |
| 332 // need to cut it into pieces and rebuild the string in Javascript. | 332 // need to cut it into pieces and rebuild the string in Javascript. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 select_trace_file_dialog_ = ui::SelectFileDialog::Create( | 365 select_trace_file_dialog_ = ui::SelectFileDialog::Create( |
| 366 this, | 366 this, |
| 367 GetContentClient()->browser()->CreateSelectFilePolicy( | 367 GetContentClient()->browser()->CreateSelectFilePolicy( |
| 368 web_ui()->GetWebContents())); | 368 web_ui()->GetWebContents())); |
| 369 select_trace_file_dialog_->SelectFile( | 369 select_trace_file_dialog_->SelectFile( |
| 370 ui::SelectFileDialog::SELECT_SAVEAS_FILE, | 370 ui::SelectFileDialog::SELECT_SAVEAS_FILE, |
| 371 string16(), | 371 string16(), |
| 372 base::FilePath(), | 372 base::FilePath(), |
| 373 NULL, | 373 NULL, |
| 374 0, | 374 0, |
| 375 FILE_PATH_LITERAL(std::string()), | 375 base::FilePath::StringType(), |
| 376 web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(), | 376 web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(), |
| 377 NULL); | 377 NULL); |
| 378 } | 378 } |
| 379 | 379 |
| 380 void TracingMessageHandler::SaveTraceFileComplete() { | 380 void TracingMessageHandler::SaveTraceFileComplete() { |
| 381 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 381 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 382 web_ui()->CallJavascriptFunction("tracingController.onSaveTraceFileComplete"); | 382 web_ui()->CallJavascriptFunction("tracingController.onSaveTraceFileComplete"); |
| 383 } | 383 } |
| 384 | 384 |
| 385 void TracingMessageHandler::OnBeginTracing(const base::ListValue* args) { | 385 void TracingMessageHandler::OnBeginTracing(const base::ListValue* args) { |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 TracingUI::TracingUI(WebUI* web_ui) : WebUIController(web_ui) { | 530 TracingUI::TracingUI(WebUI* web_ui) : WebUIController(web_ui) { |
| 531 web_ui->AddMessageHandler(new TracingMessageHandler()); | 531 web_ui->AddMessageHandler(new TracingMessageHandler()); |
| 532 | 532 |
| 533 // Set up the chrome://tracing/ source. | 533 // Set up the chrome://tracing/ source. |
| 534 BrowserContext* browser_context = | 534 BrowserContext* browser_context = |
| 535 web_ui->GetWebContents()->GetBrowserContext(); | 535 web_ui->GetWebContents()->GetBrowserContext(); |
| 536 WebUIDataSource::Add(browser_context, CreateTracingHTMLSource()); | 536 WebUIDataSource::Add(browser_context, CreateTracingHTMLSource()); |
| 537 } | 537 } |
| 538 | 538 |
| 539 } // namespace content | 539 } // namespace content |
| OLD | NEW |