#include "chrome/browser/net/net_error_tab_helper.h"
#include "base/bind.h"
-#include "base/metrics/field_trial.h"
+#include "base/logging.h"
#include "base/prefs/pref_service.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/io_thread.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/render_messages.h"
#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/render_frame_host.h"
#include "net/base/net_errors.h"
-using base::FieldTrialList;
using chrome_common_net::DnsProbeStatus;
using chrome_common_net::DnsProbeStatusToString;
using content::BrowserContext;
testing_state_ = state;
}
+void NetErrorTabHelper::DidStartNavigationToPendingEntry(
+ const GURL& url,
+ content::NavigationController::ReloadType reload_type) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ if (!is_error_page_)
+ return;
+
+ // Only record reloads.
+ if (reload_type != content::NavigationController::NO_RELOAD) {
+ chrome_common_net::RecordEvent(
+ chrome_common_net::NETWORK_ERROR_PAGE_BROWSER_INITIATED_RELOAD);
+ }
+}
+
void NetErrorTabHelper::DidStartProvisionalLoadForFrame(
- int64 frame_id,
- int64 parent_frame_id,
- bool is_main_frame,
+ content::RenderFrameHost* render_frame_host,
const GURL& validated_url,
bool is_error_page,
- bool is_iframe_srcdoc,
- RenderViewHost* render_view_host) {
+ bool is_iframe_srcdoc) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- if (!is_main_frame)
+ if (render_frame_host->GetParent())
return;
is_error_page_ = is_error_page;
}
void NetErrorTabHelper::DidCommitProvisionalLoadForFrame(
- int64 frame_id,
- const string16& frame_unique_name,
- bool is_main_frame,
+ content::RenderFrameHost* render_frame_host,
const GURL& url,
- PageTransition transition_type,
- RenderViewHost* render_view_host) {
+ PageTransition transition_type) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- if (!is_main_frame)
+ if (render_frame_host->GetParent())
return;
// Resend status every time an error page commits; this is somewhat spammy,
}
void NetErrorTabHelper::DidFailProvisionalLoad(
- int64 frame_id,
- const string16& frame_unique_name,
- bool is_main_frame,
+ content::RenderFrameHost* render_frame_host,
const GURL& validated_url,
int error_code,
- const string16& error_description,
- RenderViewHost* render_view_host) {
+ const base::string16& error_description) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- if (!is_main_frame)
+ if (render_frame_host->GetParent())
return;
if (IsDnsError(error_code)) {
is_error_page_(false),
dns_error_active_(false),
dns_error_page_committed_(false),
- dns_probe_status_(chrome_common_net::DNS_PROBE_POSSIBLE),
- probes_enabled_(chrome_common_net::DnsProbesEnabled()) {
+ dns_probe_status_(chrome_common_net::DNS_PROBE_POSSIBLE) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
// If this helper is under test, it won't have a WebContents.
return testing_state_ == TESTING_FORCE_ENABLED;
// TODO(ttuttle): Disable on mobile?
- return probes_enabled_ && *resolve_errors_with_web_service_;
+ return *resolve_errors_with_web_service_;
}
void NetErrorTabHelper::SendInfo() {
DCHECK(dns_error_page_committed_);
DVLOG(1) << "Sending status " << DnsProbeStatusToString(dns_probe_status_);
- Send(new ChromeViewMsg_NetErrorInfo(routing_id(), dns_probe_status_));
+ content::RenderFrameHost* rfh = web_contents()->GetMainFrame();
+ rfh->Send(new ChromeViewMsg_NetErrorInfo(rfh->GetRoutingID(),
+ dns_probe_status_));
if (!dns_probe_status_snoop_callback_.is_null())
dns_probe_status_snoop_callback_.Run(dns_probe_status_);