| 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.h" | 33 #include "chrome/browser/net/predictor_api.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 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 private: | 696 private: |
| 697 AboutDnsHandler(AboutSource* source, int request_id) | 697 AboutDnsHandler(AboutSource* source, int request_id) |
| 698 : source_(source), | 698 : source_(source), |
| 699 request_id_(request_id) { | 699 request_id_(request_id) { |
| 700 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 700 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 701 } | 701 } |
| 702 | 702 |
| 703 // Calls FinishOnUIThread() on completion. | 703 // Calls FinishOnUIThread() on completion. |
| 704 void StartOnUIThread() { | 704 void StartOnUIThread() { |
| 705 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 705 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 706 chrome_browser_net::Predictor* predictor = | |
| 707 source_->profile()->GetNetworkPredictor(); | |
| 708 BrowserThread::PostTask( | 706 BrowserThread::PostTask( |
| 709 BrowserThread::IO, FROM_HERE, | 707 BrowserThread::IO, FROM_HERE, |
| 710 NewRunnableMethod(this, &AboutDnsHandler::StartOnIOThread, predictor)); | 708 NewRunnableMethod(this, &AboutDnsHandler::StartOnIOThread)); |
| 711 } | 709 } |
| 712 | 710 |
| 713 void StartOnIOThread(chrome_browser_net::Predictor* predictor) { | 711 void StartOnIOThread() { |
| 714 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 712 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 715 | 713 |
| 716 std::string data; | 714 std::string data; |
| 717 AppendHeader(&data, 0, "About DNS"); | 715 AppendHeader(&data, 0, "About DNS"); |
| 718 AppendBody(&data); | 716 AppendBody(&data); |
| 719 chrome_browser_net::Predictor::PredictorGetHtmlInfo(predictor, &data); | 717 chrome_browser_net::PredictorGetHtmlInfo(&data); |
| 720 AppendFooter(&data); | 718 AppendFooter(&data); |
| 721 | 719 |
| 722 BrowserThread::PostTask( | 720 BrowserThread::PostTask( |
| 723 BrowserThread::UI, FROM_HERE, | 721 BrowserThread::UI, FROM_HERE, |
| 724 NewRunnableMethod(this, &AboutDnsHandler::FinishOnUIThread, data)); | 722 NewRunnableMethod(this, &AboutDnsHandler::FinishOnUIThread, data)); |
| 725 } | 723 } |
| 726 | 724 |
| 727 void FinishOnUIThread(const std::string& data) { | 725 void FinishOnUIThread(const std::string& data) { |
| 728 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 726 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 729 source_->FinishDataRequest(data, request_id_); | 727 source_->FinishDataRequest(data, request_id_); |
| (...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1529 return false; | 1527 return false; |
| 1530 } | 1528 } |
| 1531 | 1529 |
| 1532 std::vector<std::string> ChromePaths() { | 1530 std::vector<std::string> ChromePaths() { |
| 1533 std::vector<std::string> paths; | 1531 std::vector<std::string> paths; |
| 1534 paths.reserve(arraysize(kChromePaths)); | 1532 paths.reserve(arraysize(kChromePaths)); |
| 1535 for (size_t i = 0; i < arraysize(kChromePaths); i++) | 1533 for (size_t i = 0; i < arraysize(kChromePaths); i++) |
| 1536 paths.push_back(kChromePaths[i]); | 1534 paths.push_back(kChromePaths[i]); |
| 1537 return paths; | 1535 return paths; |
| 1538 } | 1536 } |
| OLD | NEW |