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 "chrome/browser/ui/webui/about_ui.h" | 5 #include "chrome/browser/ui/webui/about_ui.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 } | 604 } |
605 | 605 |
606 virtual ~AboutDnsHandler() {} | 606 virtual ~AboutDnsHandler() {} |
607 | 607 |
608 // Calls FinishOnUIThread() on completion. | 608 // Calls FinishOnUIThread() on completion. |
609 void StartOnUIThread() { | 609 void StartOnUIThread() { |
610 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 610 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
611 chrome_browser_net::Predictor* predictor = profile_->GetNetworkPredictor(); | 611 chrome_browser_net::Predictor* predictor = profile_->GetNetworkPredictor(); |
612 BrowserThread::PostTask( | 612 BrowserThread::PostTask( |
613 BrowserThread::IO, FROM_HERE, | 613 BrowserThread::IO, FROM_HERE, |
614 base::Bind(&AboutDnsHandler::StartOnIOThread, this, predictor)); | 614 base::BindOnce(&AboutDnsHandler::StartOnIOThread, this, predictor)); |
615 } | 615 } |
616 | 616 |
617 void StartOnIOThread(chrome_browser_net::Predictor* predictor) { | 617 void StartOnIOThread(chrome_browser_net::Predictor* predictor) { |
618 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 618 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
619 | 619 |
620 std::string data; | 620 std::string data; |
621 AppendHeader(&data, 0, "About DNS"); | 621 AppendHeader(&data, 0, "About DNS"); |
622 AppendBody(&data); | 622 AppendBody(&data); |
623 chrome_browser_net::Predictor::PredictorGetHtmlInfo(predictor, &data); | 623 chrome_browser_net::Predictor::PredictorGetHtmlInfo(predictor, &data); |
624 AppendFooter(&data); | 624 AppendFooter(&data); |
625 | 625 |
626 BrowserThread::PostTask( | 626 BrowserThread::PostTask( |
627 BrowserThread::UI, FROM_HERE, | 627 BrowserThread::UI, FROM_HERE, |
628 base::Bind(&AboutDnsHandler::FinishOnUIThread, this, data)); | 628 base::BindOnce(&AboutDnsHandler::FinishOnUIThread, this, data)); |
629 } | 629 } |
630 | 630 |
631 void FinishOnUIThread(const std::string& data) { | 631 void FinishOnUIThread(const std::string& data) { |
632 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 632 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
633 std::string data_copy(data); | 633 std::string data_copy(data); |
634 callback_.Run(base::RefCountedString::TakeString(&data_copy)); | 634 callback_.Run(base::RefCountedString::TakeString(&data_copy)); |
635 } | 635 } |
636 | 636 |
637 Profile* profile_; | 637 Profile* profile_; |
638 | 638 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 Profile* profile = Profile::FromWebUI(web_ui); | 789 Profile* profile = Profile::FromWebUI(web_ui); |
790 | 790 |
791 #if !defined(OS_ANDROID) | 791 #if !defined(OS_ANDROID) |
792 // Set up the chrome://theme/ source. | 792 // Set up the chrome://theme/ source. |
793 ThemeSource* theme = new ThemeSource(profile); | 793 ThemeSource* theme = new ThemeSource(profile); |
794 content::URLDataSource::Add(profile, theme); | 794 content::URLDataSource::Add(profile, theme); |
795 #endif | 795 #endif |
796 | 796 |
797 content::URLDataSource::Add(profile, new AboutUIHTMLSource(name, profile)); | 797 content::URLDataSource::Add(profile, new AboutUIHTMLSource(name, profile)); |
798 } | 798 } |
OLD | NEW |