Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/dns_global.h" | 5 #include "chrome/browser/net/dns_global.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/stats_counters.h" | 10 #include "base/stats_counters.h" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "base/values.h" | 12 #include "base/values.h" |
| 13 #include "chrome/browser/browser.h" | 13 #include "chrome/browser/browser.h" |
| 14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
| 15 #include "chrome/browser/net/dns_host_info.h" | 15 #include "chrome/browser/net/dns_host_info.h" |
| 16 #include "chrome/browser/net/referrer.h" | 16 #include "chrome/browser/net/referrer.h" |
| 17 #include "chrome/browser/profile.h" | 17 #include "chrome/browser/profile.h" |
| 18 #include "chrome/browser/session_startup_pref.h" | 18 #include "chrome/browser/session_startup_pref.h" |
| 19 #include "chrome/common/notification_type.h" | 19 #include "chrome/common/notification_type.h" |
| 20 #include "chrome/common/notification_service.h" | 20 #include "chrome/common/notification_service.h" |
| 21 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
| 22 #include "chrome/common/pref_service.h" | 22 #include "chrome/common/pref_service.h" |
| 23 #include "googleurl/src/gurl.h" | |
| 24 #include "net/base/dns_resolution_observer.h" | 23 #include "net/base/dns_resolution_observer.h" |
| 25 | 24 |
| 26 using base::TimeDelta; | 25 using base::TimeDelta; |
| 27 | 26 |
| 28 namespace chrome_browser_net { | 27 namespace chrome_browser_net { |
| 29 | 28 |
| 30 static void DiscardAllPrefetchState(); | 29 static void DiscardAllPrefetchState(); |
| 31 static void DnsMotivatedPrefetch(const std::string& hostname, | 30 static void DnsMotivatedPrefetch(const std::string& hostname, |
| 32 DnsHostInfo::ResolutionMotivation motivation); | 31 DnsHostInfo::ResolutionMotivation motivation); |
| 33 static void DnsPrefetchMotivatedList( | 32 static void DnsPrefetchMotivatedList( |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 446 hostnames.push_back(hostname); | 445 hostnames.push_back(hostname); |
| 447 } | 446 } |
| 448 } | 447 } |
| 449 | 448 |
| 450 // Prepare for any static home page(s) the user has in prefs. The user may | 449 // Prepare for any static home page(s) the user has in prefs. The user may |
| 451 // have a LOT of tab's specified, so we may as well try to warm them all. | 450 // have a LOT of tab's specified, so we may as well try to warm them all. |
| 452 SessionStartupPref tab_start_pref = | 451 SessionStartupPref tab_start_pref = |
| 453 SessionStartupPref::GetStartupPref(user_prefs); | 452 SessionStartupPref::GetStartupPref(user_prefs); |
| 454 if (SessionStartupPref::URLS == tab_start_pref.type) { | 453 if (SessionStartupPref::URLS == tab_start_pref.type) { |
| 455 for (size_t i = 0; i < tab_start_pref.urls.size(); i++) { | 454 for (size_t i = 0; i < tab_start_pref.urls.size(); i++) { |
| 456 GURL gurl = tab_start_pref.urls[i]; | 455 GURL gurl = tab_start_pref.urls[i]; |
|
Dean McNamee
2009/02/19 11:50:32
GURL is used here, but you removed the include. A
| |
| 457 if (gurl.is_valid() && !gurl.host().empty()) | 456 if (gurl.is_valid() && !gurl.host().empty()) |
| 458 hostnames.push_back(gurl.host()); | 457 hostnames.push_back(gurl.host()); |
| 459 } | 458 } |
| 460 } | 459 } |
| 461 | 460 |
| 462 if (hostnames.size() > 0) | 461 if (hostnames.size() > 0) |
| 463 DnsPrefetchMotivatedList(hostnames, DnsHostInfo::STARTUP_LIST_MOTIVATED); | 462 DnsPrefetchMotivatedList(hostnames, DnsHostInfo::STARTUP_LIST_MOTIVATED); |
| 464 else // Start a thread. | 463 else // Start a thread. |
| 465 DnsMotivatedPrefetch(std::string("www.google.com"), | 464 DnsMotivatedPrefetch(std::string("www.google.com"), |
| 466 DnsHostInfo::STARTUP_LIST_MOTIVATED); | 465 DnsHostInfo::STARTUP_LIST_MOTIVATED); |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 488 } | 487 } |
| 489 | 488 |
| 490 void TrimSubresourceReferrers() { | 489 void TrimSubresourceReferrers() { |
| 491 if (NULL == dns_master) | 490 if (NULL == dns_master) |
| 492 return; | 491 return; |
| 493 dns_master->TrimReferrers(); | 492 dns_master->TrimReferrers(); |
| 494 } | 493 } |
| 495 | 494 |
| 496 } // namespace chrome_browser_net | 495 } // namespace chrome_browser_net |
| 497 | 496 |
| OLD | NEW |