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/singleton.h" | 10 #include "base/singleton.h" |
11 #include "base/stats_counters.h" | 11 #include "base/stats_counters.h" |
12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
13 #include "base/thread.h" | 13 #include "base/thread.h" |
14 #include "base/values.h" | 14 #include "base/values.h" |
15 #include "chrome/browser/browser.h" | 15 #include "chrome/browser/browser.h" |
16 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
17 #include "chrome/browser/net/dns_host_info.h" | 17 #include "chrome/browser/net/dns_host_info.h" |
18 #include "chrome/browser/net/referrer.h" | 18 #include "chrome/browser/net/referrer.h" |
19 #include "chrome/browser/profile.h" | 19 #include "chrome/browser/profile.h" |
20 #include "chrome/browser/session_startup_pref.h" | 20 #include "chrome/browser/session_startup_pref.h" |
21 #include "chrome/common/notification_registrar.h" | 21 #include "chrome/common/notification_registrar.h" |
22 #include "chrome/common/notification_service.h" | 22 #include "chrome/common/notification_service.h" |
23 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
24 #include "chrome/common/pref_service.h" | 24 #include "chrome/common/pref_service.h" |
25 #include "net/base/dns_resolution_observer.h" | |
26 #include "net/base/host_resolver.h" | 25 #include "net/base/host_resolver.h" |
27 | 26 |
28 using base::TimeDelta; | 27 using base::TimeDelta; |
29 | 28 |
30 namespace chrome_browser_net { | 29 namespace chrome_browser_net { |
31 | 30 |
32 static void DiscardAllPrefetchState(); | 31 static void DiscardAllPrefetchState(); |
33 static void DnsMotivatedPrefetch(const std::string& hostname, | 32 static void DnsMotivatedPrefetch(const std::string& hostname, |
34 DnsHostInfo::ResolutionMotivation motivation); | 33 DnsHostInfo::ResolutionMotivation motivation); |
35 static void DnsPrefetchMotivatedList( | 34 static void DnsPrefetchMotivatedList( |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 dns_master->NavigatingTo(host_name); | 130 dns_master->NavigatingTo(host_name); |
132 } | 131 } |
133 | 132 |
134 // The observer class needs to connect starts and finishes of HTTP network | 133 // The observer class needs to connect starts and finishes of HTTP network |
135 // resolutions. We use the following type for that map. | 134 // resolutions. We use the following type for that map. |
136 typedef std::map<int, DnsHostInfo> ObservedResolutionMap; | 135 typedef std::map<int, DnsHostInfo> ObservedResolutionMap; |
137 | 136 |
138 // There will only be one instance ever created of the following Observer | 137 // There will only be one instance ever created of the following Observer |
139 // class. As a result, we get away with using static members for data local | 138 // class. As a result, we get away with using static members for data local |
140 // to that instance (to better comply with a google style guide exemption). | 139 // to that instance (to better comply with a google style guide exemption). |
141 class PrefetchObserver : public net::DnsResolutionObserver { | 140 class PrefetchObserver : public net::HostResolver::Observer { |
142 public: | 141 public: |
143 PrefetchObserver(); | 142 PrefetchObserver(); |
144 ~PrefetchObserver(); | 143 ~PrefetchObserver(); |
145 | 144 |
146 virtual void OnStartResolution( | 145 virtual void OnStartResolution( |
147 int request_id, | 146 int request_id, |
148 const net::HostResolver::RequestInfo& request_info); | 147 const net::HostResolver::RequestInfo& request_info); |
149 virtual void OnFinishResolutionWithStatus( | 148 virtual void OnFinishResolutionWithStatus( |
150 int request_id, | 149 int request_id, |
151 bool was_resolved, | 150 bool was_resolved, |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 dns_master->DeserializeReferrers(*referral_list); | 529 dns_master->DeserializeReferrers(*referral_list); |
531 } | 530 } |
532 | 531 |
533 void TrimSubresourceReferrers() { | 532 void TrimSubresourceReferrers() { |
534 if (NULL == dns_master) | 533 if (NULL == dns_master) |
535 return; | 534 return; |
536 dns_master->TrimReferrers(); | 535 dns_master->TrimReferrers(); |
537 } | 536 } |
538 | 537 |
539 } // namespace chrome_browser_net | 538 } // namespace chrome_browser_net |
OLD | NEW |