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