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 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 std::set<std::string> ret; | 515 std::set<std::string> ret; |
516 OnKnownCategoriesCollected(ret); | 516 OnKnownCategoriesCollected(ret); |
517 } | 517 } |
518 } | 518 } |
519 | 519 |
520 void TracingMessageHandler::OnKnownCategoriesCollected( | 520 void TracingMessageHandler::OnKnownCategoriesCollected( |
521 const std::set<std::string>& known_categories) { | 521 const std::set<std::string>& known_categories) { |
522 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 522 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
523 | 523 |
524 scoped_ptr<base::ListValue> categories(new base::ListValue()); | 524 scoped_ptr<base::ListValue> categories(new base::ListValue()); |
525 for (std::set<std::string>::iterator iter = known_categories.begin(); | 525 for (std::set<std::string>::const_iterator iter = known_categories.begin(); |
526 iter != known_categories.end(); | 526 iter != known_categories.end(); |
527 ++iter) { | 527 ++iter) { |
528 categories->AppendString(*iter); | 528 categories->AppendString(*iter); |
529 } | 529 } |
530 | 530 |
531 web_ui()->CallJavascriptFunction( | 531 web_ui()->CallJavascriptFunction( |
532 "tracingController.onKnownCategoriesCollected", *categories); | 532 "tracingController.onKnownCategoriesCollected", *categories); |
533 } | 533 } |
534 | 534 |
535 } // namespace | 535 } // namespace |
536 | 536 |
537 | 537 |
538 //////////////////////////////////////////////////////////////////////////////// | 538 //////////////////////////////////////////////////////////////////////////////// |
539 // | 539 // |
540 // TracingUI | 540 // TracingUI |
541 // | 541 // |
542 //////////////////////////////////////////////////////////////////////////////// | 542 //////////////////////////////////////////////////////////////////////////////// |
543 | 543 |
544 TracingUI::TracingUI(WebUI* web_ui) : WebUIController(web_ui) { | 544 TracingUI::TracingUI(WebUI* web_ui) : WebUIController(web_ui) { |
545 web_ui->AddMessageHandler(new TracingMessageHandler()); | 545 web_ui->AddMessageHandler(new TracingMessageHandler()); |
546 | 546 |
547 // Set up the chrome://tracing/ source. | 547 // Set up the chrome://tracing/ source. |
548 BrowserContext* browser_context = | 548 BrowserContext* browser_context = |
549 web_ui->GetWebContents()->GetBrowserContext(); | 549 web_ui->GetWebContents()->GetBrowserContext(); |
550 WebUIDataSource::Add(browser_context, CreateTracingHTMLSource()); | 550 WebUIDataSource::Add(browser_context, CreateTracingHTMLSource()); |
551 } | 551 } |
552 | 552 |
553 } // namespace content | 553 } // namespace content |
OLD | NEW |