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 <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 // the DNS information. | 736 // the DNS information. |
737 class AboutDnsHandler : public base::RefCountedThreadSafe<AboutDnsHandler> { | 737 class AboutDnsHandler : public base::RefCountedThreadSafe<AboutDnsHandler> { |
738 public: | 738 public: |
739 static void Start(AboutUIHTMLSource* source, int request_id) { | 739 static void Start(AboutUIHTMLSource* source, int request_id) { |
740 scoped_refptr<AboutDnsHandler> handler( | 740 scoped_refptr<AboutDnsHandler> handler( |
741 new AboutDnsHandler(source, request_id)); | 741 new AboutDnsHandler(source, request_id)); |
742 handler->StartOnUIThread(); | 742 handler->StartOnUIThread(); |
743 } | 743 } |
744 | 744 |
745 private: | 745 private: |
| 746 friend class base::RefCountedThreadSafe<AboutDnsHandler>; |
| 747 |
746 AboutDnsHandler(AboutUIHTMLSource* source, int request_id) | 748 AboutDnsHandler(AboutUIHTMLSource* source, int request_id) |
747 : source_(source), | 749 : source_(source), |
748 request_id_(request_id) { | 750 request_id_(request_id) { |
749 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 751 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
750 } | 752 } |
751 | 753 |
| 754 virtual ~AboutDnsHandler() {} |
| 755 |
752 // Calls FinishOnUIThread() on completion. | 756 // Calls FinishOnUIThread() on completion. |
753 void StartOnUIThread() { | 757 void StartOnUIThread() { |
754 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 758 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
755 chrome_browser_net::Predictor* predictor = | 759 chrome_browser_net::Predictor* predictor = |
756 source_->profile()->GetNetworkPredictor(); | 760 source_->profile()->GetNetworkPredictor(); |
757 BrowserThread::PostTask( | 761 BrowserThread::PostTask( |
758 BrowserThread::IO, FROM_HERE, | 762 BrowserThread::IO, FROM_HERE, |
759 base::Bind(&AboutDnsHandler::StartOnIOThread, this, predictor)); | 763 base::Bind(&AboutDnsHandler::StartOnIOThread, this, predictor)); |
760 } | 764 } |
761 | 765 |
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1506 } | 1510 } |
1507 | 1511 |
1508 AboutUI::AboutUI(content::WebUI* web_ui, const std::string& name) | 1512 AboutUI::AboutUI(content::WebUI* web_ui, const std::string& name) |
1509 : WebUIController(web_ui) { | 1513 : WebUIController(web_ui) { |
1510 Profile* profile = Profile::FromWebUI(web_ui); | 1514 Profile* profile = Profile::FromWebUI(web_ui); |
1511 ChromeURLDataManager::DataSource* source = | 1515 ChromeURLDataManager::DataSource* source = |
1512 new AboutUIHTMLSource(name, profile); | 1516 new AboutUIHTMLSource(name, profile); |
1513 if (source) | 1517 if (source) |
1514 profile->GetChromeURLDataManager()->AddDataSource(source); | 1518 profile->GetChromeURLDataManager()->AddDataSource(source); |
1515 } | 1519 } |
OLD | NEW |