summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/net/net_error_tab_helper.cc19
-rw-r--r--chrome/browser/net/net_error_tab_helper.h2
-rw-r--r--chrome/browser/ui/navigation_correction_tab_observer.cc23
-rw-r--r--chrome/browser/ui/navigation_correction_tab_observer.h5
4 files changed, 26 insertions, 23 deletions
diff --git a/chrome/browser/net/net_error_tab_helper.cc b/chrome/browser/net/net_error_tab_helper.cc
index f0cbcf9..8e325f9 100644
--- a/chrome/browser/net/net_error_tab_helper.cc
+++ b/chrome/browser/net/net_error_tab_helper.cc
@@ -18,14 +18,12 @@
#include "components/error_page/common/net_error_info.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_frame_host.h"
-#include "content/public/browser/render_view_host.h"
#include "ipc/ipc_message_macros.h"
#include "net/base/net_errors.h"
#include "url/gurl.h"
using content::BrowserContext;
using content::BrowserThread;
-using content::RenderViewHost;
using content::WebContents;
using content::WebContentsObserver;
using error_page::DnsProbeStatus;
@@ -82,13 +80,16 @@ void NetErrorTabHelper::set_state_for_testing(TestingState state) {
testing_state_ = state;
}
-void NetErrorTabHelper::RenderViewCreated(
- content::RenderViewHost* render_view_host) {
- content::RenderFrameHost* render_frame_host =
- render_view_host->GetMainFrame();
- render_frame_host->Send(new ChromeViewMsg_SetCanShowNetworkDiagnosticsDialog(
- render_frame_host->GetRoutingID(),
- CanShowNetworkDiagnosticsDialog()));
+void NetErrorTabHelper::RenderFrameCreated(
+ content::RenderFrameHost* render_frame_host) {
+ // Ignore subframe creation - only main frame error pages can link to the
+ // platform's network diagnostics dialog.
+ if (render_frame_host->GetParent())
+ return;
+ render_frame_host->Send(
+ new ChromeViewMsg_SetCanShowNetworkDiagnosticsDialog(
+ render_frame_host->GetRoutingID(),
+ CanShowNetworkDiagnosticsDialog()));
}
void NetErrorTabHelper::DidStartNavigationToPendingEntry(
diff --git a/chrome/browser/net/net_error_tab_helper.h b/chrome/browser/net/net_error_tab_helper.h
index 490b432..4e6b83e 100644
--- a/chrome/browser/net/net_error_tab_helper.h
+++ b/chrome/browser/net/net_error_tab_helper.h
@@ -48,7 +48,7 @@ class NetErrorTabHelper
}
// content::WebContentsObserver implementation.
- void RenderViewCreated(content::RenderViewHost* render_view_host) override;
+ void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override;
void DidStartNavigationToPendingEntry(
const GURL& url,
diff --git a/chrome/browser/ui/navigation_correction_tab_observer.cc b/chrome/browser/ui/navigation_correction_tab_observer.cc
index 6be6a9f..a943d40 100644
--- a/chrome/browser/ui/navigation_correction_tab_observer.cc
+++ b/chrome/browser/ui/navigation_correction_tab_observer.cc
@@ -15,12 +15,10 @@
#include "components/google/core/browser/google_util.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "content/public/browser/render_frame_host.h"
-#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
#include "google_apis/google_api_keys.h"
using content::RenderFrameHost;
-using content::RenderViewHost;
using content::WebContents;
DEFINE_WEB_CONTENTS_USER_DATA_KEY(NavigationCorrectionTabObserver);
@@ -65,16 +63,20 @@ void NavigationCorrectionTabObserver::RegisterProfilePrefs(
////////////////////////////////////////////////////////////////////////////////
// WebContentsObserver overrides
-void NavigationCorrectionTabObserver::RenderViewCreated(
- RenderViewHost* render_view_host) {
- UpdateNavigationCorrectionInfo(render_view_host);
+void NavigationCorrectionTabObserver::RenderFrameCreated(
+ RenderFrameHost* render_frame_host) {
+ // Ignore subframe creation - only main frame error pages can request and
+ // display nagivation correction information.
+ if (render_frame_host->GetParent())
+ return;
+ UpdateNavigationCorrectionInfo(render_frame_host);
}
////////////////////////////////////////////////////////////////////////////////
// Internal helpers
void NavigationCorrectionTabObserver::OnGoogleURLUpdated() {
- UpdateNavigationCorrectionInfo(web_contents()->GetRenderViewHost());
+ UpdateNavigationCorrectionInfo(web_contents()->GetMainFrame());
}
GURL NavigationCorrectionTabObserver::GetNavigationCorrectionURL() const {
@@ -89,15 +91,14 @@ GURL NavigationCorrectionTabObserver::GetNavigationCorrectionURL() const {
}
void NavigationCorrectionTabObserver::OnEnabledChanged() {
- UpdateNavigationCorrectionInfo(web_contents()->GetRenderViewHost());
+ UpdateNavigationCorrectionInfo(web_contents()->GetMainFrame());
}
void NavigationCorrectionTabObserver::UpdateNavigationCorrectionInfo(
- RenderViewHost* rvh) {
- RenderFrameHost* rfh = rvh->GetMainFrame();
+ RenderFrameHost* render_frame_host) {
GURL google_base_url(UIThreadSearchTermsData(profile_).GoogleBaseURLValue());
- rfh->Send(new ChromeViewMsg_SetNavigationCorrectionInfo(
- rfh->GetRoutingID(),
+ render_frame_host->Send(new ChromeViewMsg_SetNavigationCorrectionInfo(
+ render_frame_host->GetRoutingID(),
GetNavigationCorrectionURL(),
google_util::GetGoogleLocale(g_browser_process->GetApplicationLocale()),
google_util::GetGoogleCountryCode(google_base_url),
diff --git a/chrome/browser/ui/navigation_correction_tab_observer.h b/chrome/browser/ui/navigation_correction_tab_observer.h
index 85a2095..cc562f9 100644
--- a/chrome/browser/ui/navigation_correction_tab_observer.h
+++ b/chrome/browser/ui/navigation_correction_tab_observer.h
@@ -30,7 +30,7 @@ class NavigationCorrectionTabObserver
friend class content::WebContentsUserData<NavigationCorrectionTabObserver>;
// content::WebContentsObserver overrides:
- void RenderViewCreated(content::RenderViewHost* render_view_host) override;
+ void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override;
// Internal helpers ----------------------------------------------------------
@@ -45,7 +45,8 @@ class NavigationCorrectionTabObserver
void OnEnabledChanged();
// Updates the renderer's navigation correction service configuration.
- void UpdateNavigationCorrectionInfo(content::RenderViewHost* rvh);
+ void UpdateNavigationCorrectionInfo(
+ content::RenderFrameHost* render_frame_host);
Profile* profile_;
PrefChangeRegistrar pref_change_registrar_;