OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser_about_handler.h" | 5 #include "chrome/browser/browser_about_handler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "base/stringprintf.h" | 23 #include "base/stringprintf.h" |
24 #include "base/threading/thread.h" | 24 #include "base/threading/thread.h" |
25 #include "base/tracked_objects.h" | 25 #include "base/tracked_objects.h" |
26 #include "base/utf_string_conversions.h" | 26 #include "base/utf_string_conversions.h" |
27 #include "base/values.h" | 27 #include "base/values.h" |
28 #include "chrome/browser/about_flags.h" | 28 #include "chrome/browser/about_flags.h" |
29 #include "chrome/browser/browser_process.h" | 29 #include "chrome/browser/browser_process.h" |
30 #include "chrome/browser/defaults.h" | 30 #include "chrome/browser/defaults.h" |
31 #include "chrome/browser/memory_details.h" | 31 #include "chrome/browser/memory_details.h" |
32 #include "chrome/browser/metrics/histogram_synchronizer.h" | 32 #include "chrome/browser/metrics/histogram_synchronizer.h" |
33 #include "chrome/browser/net/predictor_api.h" | 33 #include "chrome/browser/net/predictor.h" |
34 #include "chrome/browser/net/url_fixer_upper.h" | 34 #include "chrome/browser/net/url_fixer_upper.h" |
35 #include "chrome/browser/plugin_prefs.h" | 35 #include "chrome/browser/plugin_prefs.h" |
36 #include "chrome/browser/profiles/profile.h" | 36 #include "chrome/browser/profiles/profile.h" |
37 #include "chrome/browser/profiles/profile_manager.h" | 37 #include "chrome/browser/profiles/profile_manager.h" |
38 #include "chrome/browser/ui/browser_dialogs.h" | 38 #include "chrome/browser/ui/browser_dialogs.h" |
39 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 39 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
40 #include "chrome/common/about_handler.h" | 40 #include "chrome/common/about_handler.h" |
41 #include "chrome/common/chrome_paths.h" | 41 #include "chrome/common/chrome_paths.h" |
42 #include "chrome/common/chrome_version_info.h" | 42 #include "chrome/common/chrome_version_info.h" |
43 #include "chrome/common/jstemplate_builder.h" | 43 #include "chrome/common/jstemplate_builder.h" |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 private: | 719 private: |
720 AboutDnsHandler(AboutSource* source, int request_id) | 720 AboutDnsHandler(AboutSource* source, int request_id) |
721 : source_(source), | 721 : source_(source), |
722 request_id_(request_id) { | 722 request_id_(request_id) { |
723 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 723 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
724 } | 724 } |
725 | 725 |
726 // Calls FinishOnUIThread() on completion. | 726 // Calls FinishOnUIThread() on completion. |
727 void StartOnUIThread() { | 727 void StartOnUIThread() { |
728 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 728 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 729 chrome_browser_net::Predictor* predictor = |
| 730 source_->profile()->GetNetworkPredictor(); |
729 BrowserThread::PostTask( | 731 BrowserThread::PostTask( |
730 BrowserThread::IO, FROM_HERE, | 732 BrowserThread::IO, FROM_HERE, |
731 NewRunnableMethod(this, &AboutDnsHandler::StartOnIOThread)); | 733 NewRunnableMethod(this, &AboutDnsHandler::StartOnIOThread, predictor)); |
732 } | 734 } |
733 | 735 |
734 void StartOnIOThread() { | 736 void StartOnIOThread(chrome_browser_net::Predictor* predictor) { |
735 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 737 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
736 | 738 |
737 std::string data; | 739 std::string data; |
738 AppendHeader(&data, 0, "About DNS"); | 740 AppendHeader(&data, 0, "About DNS"); |
739 AppendBody(&data); | 741 AppendBody(&data); |
740 chrome_browser_net::PredictorGetHtmlInfo(&data); | 742 chrome_browser_net::Predictor::PredictorGetHtmlInfo(predictor, &data); |
741 AppendFooter(&data); | 743 AppendFooter(&data); |
742 | 744 |
743 BrowserThread::PostTask( | 745 BrowserThread::PostTask( |
744 BrowserThread::UI, FROM_HERE, | 746 BrowserThread::UI, FROM_HERE, |
745 NewRunnableMethod(this, &AboutDnsHandler::FinishOnUIThread, data)); | 747 NewRunnableMethod(this, &AboutDnsHandler::FinishOnUIThread, data)); |
746 } | 748 } |
747 | 749 |
748 void FinishOnUIThread(const std::string& data) { | 750 void FinishOnUIThread(const std::string& data) { |
749 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 751 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
750 source_->FinishDataRequest(data, request_id_); | 752 source_->FinishDataRequest(data, request_id_); |
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1577 return false; | 1579 return false; |
1578 } | 1580 } |
1579 | 1581 |
1580 std::vector<std::string> ChromePaths() { | 1582 std::vector<std::string> ChromePaths() { |
1581 std::vector<std::string> paths; | 1583 std::vector<std::string> paths; |
1582 paths.reserve(arraysize(kChromePaths)); | 1584 paths.reserve(arraysize(kChromePaths)); |
1583 for (size_t i = 0; i < arraysize(kChromePaths); i++) | 1585 for (size_t i = 0; i < arraysize(kChromePaths); i++) |
1584 paths.push_back(kChromePaths[i]); | 1586 paths.push_back(kChromePaths[i]); |
1585 return paths; | 1587 return paths; |
1586 } | 1588 } |
OLD | NEW |