| 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/net/predictor_api.h" | 5 #include "chrome/browser/net/predictor_api.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 base::LINKER_INITIALIZED); | 353 base::LINKER_INITIALIZED); |
| 354 | 354 |
| 355 //------------------------------------------------------------------------------ | 355 //------------------------------------------------------------------------------ |
| 356 // This section supports the about:dns page. | 356 // This section supports the about:dns page. |
| 357 //------------------------------------------------------------------------------ | 357 //------------------------------------------------------------------------------ |
| 358 | 358 |
| 359 // Provide global support for the about:dns page. | 359 // Provide global support for the about:dns page. |
| 360 void PredictorGetHtmlInfo(std::string* output) { | 360 void PredictorGetHtmlInfo(std::string* output) { |
| 361 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 361 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 362 | 362 |
| 363 output->append("<html><head><title>About DNS</title>" | |
| 364 // We'd like the following no-cache... but it doesn't work. | |
| 365 // "<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">" | |
| 366 "</head><body>"); | |
| 367 if (!predictor_enabled || NULL == g_predictor) { | 363 if (!predictor_enabled || NULL == g_predictor) { |
| 368 output->append("DNS pre-resolution and TCP pre-connection is disabled."); | 364 output->append("DNS pre-resolution and TCP pre-connection is disabled."); |
| 369 } else { | 365 } else { |
| 370 if (!on_the_record_switch) { | 366 if (!on_the_record_switch) { |
| 371 output->append("Incognito mode is active in a window."); | 367 output->append("Incognito mode is active in a window."); |
| 372 } else { | 368 } else { |
| 373 // List items fetched at startup. | 369 // List items fetched at startup. |
| 374 if (g_initial_observer) | 370 if (g_initial_observer) |
| 375 g_initial_observer->GetFirstResolutionsHtml(output); | 371 g_initial_observer->GetFirstResolutionsHtml(output); |
| 376 // Show list of subresource predictions and stats. | 372 // Show list of subresource predictions and stats. |
| 377 g_predictor->GetHtmlReferrerLists(output); | 373 g_predictor->GetHtmlReferrerLists(output); |
| 378 // Show list of prediction results. | 374 // Show list of prediction results. |
| 379 g_predictor->GetHtmlInfo(output); | 375 g_predictor->GetHtmlInfo(output); |
| 380 } | 376 } |
| 381 } | 377 } |
| 382 output->append("</body></html>"); | |
| 383 } | 378 } |
| 384 | 379 |
| 385 void ClearPredictorCache() { | 380 void ClearPredictorCache() { |
| 386 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 381 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 387 if (!predictor_enabled || NULL == g_predictor) | 382 if (!predictor_enabled || NULL == g_predictor) |
| 388 return; | 383 return; |
| 389 g_predictor->DiscardAllResults(); | 384 g_predictor->DiscardAllResults(); |
| 390 } | 385 } |
| 391 | 386 |
| 392 //------------------------------------------------------------------------------ | 387 //------------------------------------------------------------------------------ |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 DCHECK(!g_predictor); | 640 DCHECK(!g_predictor); |
| 646 InitNetworkPredictor(max_queueing_delay, max_parallel_resolves, user_prefs, | 641 InitNetworkPredictor(max_queueing_delay, max_parallel_resolves, user_prefs, |
| 647 local_state, preconnect_enabled); | 642 local_state, preconnect_enabled); |
| 648 } | 643 } |
| 649 } | 644 } |
| 650 | 645 |
| 651 PredictorInit::~PredictorInit() { | 646 PredictorInit::~PredictorInit() { |
| 652 } | 647 } |
| 653 | 648 |
| 654 } // namespace chrome_browser_net | 649 } // namespace chrome_browser_net |
| OLD | NEW |