OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/net_error_tab_helper.h" | 5 #include "chrome/browser/net/net_error_tab_helper.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 return; | 139 return; |
140 | 140 |
141 if (IsDnsError(error_code)) { | 141 if (IsDnsError(error_code)) { |
142 dns_error_active_ = true; | 142 dns_error_active_ = true; |
143 OnMainFrameDnsError(); | 143 OnMainFrameDnsError(); |
144 } | 144 } |
145 } | 145 } |
146 | 146 |
147 NetErrorTabHelper::NetErrorTabHelper(WebContents* contents) | 147 NetErrorTabHelper::NetErrorTabHelper(WebContents* contents) |
148 : WebContentsObserver(contents), | 148 : WebContentsObserver(contents), |
149 weak_factory_(this), | |
150 is_error_page_(false), | 149 is_error_page_(false), |
151 dns_error_active_(false), | 150 dns_error_active_(false), |
152 dns_error_page_committed_(false), | 151 dns_error_page_committed_(false), |
153 dns_probe_status_(chrome_common_net::DNS_PROBE_POSSIBLE) { | 152 dns_probe_status_(chrome_common_net::DNS_PROBE_POSSIBLE), |
| 153 weak_factory_(this) { |
154 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 154 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
155 | 155 |
156 // If this helper is under test, it won't have a WebContents. | 156 // If this helper is under test, it won't have a WebContents. |
157 if (contents) | 157 if (contents) |
158 InitializePref(contents); | 158 InitializePref(contents); |
159 } | 159 } |
160 | 160 |
161 void NetErrorTabHelper::OnMainFrameDnsError() { | 161 void NetErrorTabHelper::OnMainFrameDnsError() { |
162 if (ProbesAllowed()) { | 162 if (ProbesAllowed()) { |
163 // Don't start more than one probe at a time. | 163 // Don't start more than one probe at a time. |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 DVLOG(1) << "Sending status " << DnsProbeStatusToString(dns_probe_status_); | 225 DVLOG(1) << "Sending status " << DnsProbeStatusToString(dns_probe_status_); |
226 content::RenderFrameHost* rfh = web_contents()->GetMainFrame(); | 226 content::RenderFrameHost* rfh = web_contents()->GetMainFrame(); |
227 rfh->Send(new ChromeViewMsg_NetErrorInfo(rfh->GetRoutingID(), | 227 rfh->Send(new ChromeViewMsg_NetErrorInfo(rfh->GetRoutingID(), |
228 dns_probe_status_)); | 228 dns_probe_status_)); |
229 | 229 |
230 if (!dns_probe_status_snoop_callback_.is_null()) | 230 if (!dns_probe_status_snoop_callback_.is_null()) |
231 dns_probe_status_snoop_callback_.Run(dns_probe_status_); | 231 dns_probe_status_snoop_callback_.Run(dns_probe_status_); |
232 } | 232 } |
233 | 233 |
234 } // namespace chrome_browser_net | 234 } // namespace chrome_browser_net |
OLD | NEW |