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/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
9 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/io_thread.h" | 11 #include "chrome/browser/io_thread.h" |
11 #include "chrome/browser/net/dns_probe_service.h" | 12 #include "chrome/browser/net/dns_probe_service.h" |
12 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/common/net/net_error_info.h" | 14 #include "chrome/common/net/net_error_info.h" |
14 #include "chrome/common/pref_names.h" | 15 #include "chrome/common/pref_names.h" |
15 #include "chrome/common/render_messages.h" | 16 #include "chrome/common/render_messages.h" |
16 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
17 #include "content/public/browser/render_frame_host.h" | 18 #include "content/public/browser/render_frame_host.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 } // namespace | 70 } // namespace |
70 | 71 |
71 NetErrorTabHelper::~NetErrorTabHelper() { | 72 NetErrorTabHelper::~NetErrorTabHelper() { |
72 } | 73 } |
73 | 74 |
74 // static | 75 // static |
75 void NetErrorTabHelper::set_state_for_testing(TestingState state) { | 76 void NetErrorTabHelper::set_state_for_testing(TestingState state) { |
76 testing_state_ = state; | 77 testing_state_ = state; |
77 } | 78 } |
78 | 79 |
| 80 void NetErrorTabHelper::DidStartNavigationToPendingEntry( |
| 81 const GURL& url, |
| 82 content::NavigationController::ReloadType reload_type) { |
| 83 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 84 |
| 85 if (!is_error_page_) |
| 86 return; |
| 87 |
| 88 // Only record reloads. |
| 89 if (reload_type != content::NavigationController::NO_RELOAD) { |
| 90 chrome_common_net::RecordEvent( |
| 91 chrome_common_net::NETWORK_ERROR_PAGE_BROWSER_INITIATED_RELOAD); |
| 92 } |
| 93 } |
| 94 |
79 void NetErrorTabHelper::DidStartProvisionalLoadForFrame( | 95 void NetErrorTabHelper::DidStartProvisionalLoadForFrame( |
80 int64 frame_id, | 96 int64 frame_id, |
81 int64 parent_frame_id, | 97 int64 parent_frame_id, |
82 bool is_main_frame, | 98 bool is_main_frame, |
83 const GURL& validated_url, | 99 const GURL& validated_url, |
84 bool is_error_page, | 100 bool is_error_page, |
85 bool is_iframe_srcdoc, | 101 bool is_iframe_srcdoc, |
86 RenderViewHost* render_view_host) { | 102 RenderViewHost* render_view_host) { |
87 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 103 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
88 | 104 |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 DVLOG(1) << "Sending status " << DnsProbeStatusToString(dns_probe_status_); | 234 DVLOG(1) << "Sending status " << DnsProbeStatusToString(dns_probe_status_); |
219 content::RenderFrameHost* rfh = web_contents()->GetMainFrame(); | 235 content::RenderFrameHost* rfh = web_contents()->GetMainFrame(); |
220 rfh->Send(new ChromeViewMsg_NetErrorInfo(rfh->GetRoutingID(), | 236 rfh->Send(new ChromeViewMsg_NetErrorInfo(rfh->GetRoutingID(), |
221 dns_probe_status_)); | 237 dns_probe_status_)); |
222 | 238 |
223 if (!dns_probe_status_snoop_callback_.is_null()) | 239 if (!dns_probe_status_snoop_callback_.is_null()) |
224 dns_probe_status_snoop_callback_.Run(dns_probe_status_); | 240 dns_probe_status_snoop_callback_.Run(dns_probe_status_); |
225 } | 241 } |
226 | 242 |
227 } // namespace chrome_browser_net | 243 } // namespace chrome_browser_net |
OLD | NEW |