0

Remove InterstitialPage

InterstitialPage is not used with committed interstitials. This CL
removes the class and cleans up its usage.

Follow ups to this CL:
-Remove InterstitialPage specific methods from WebContents
 Observers (crrev.com/c/2147921).
-Remove transient entries concept (crrev.com/c/2149954).

Bug: 1077074

Change-Id: I0e08a3f8df77a91f3cea5a030793b405c2eef29d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2146137
Reviewed-by: Bo <boliu@chromium.org>
Reviewed-by: Colin Blundell <blundell@chromium.org>
Reviewed-by: David Bertoni <dbertoni@chromium.org>
Reviewed-by: Matt Menke <mmenke@chromium.org>
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Emily Stark <estark@chromium.org>
Auto-Submit: Carlos IL <carlosil@chromium.org>
Commit-Queue: Nasko Oskov <nasko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#766516}
This commit is contained in:
Carlos IL
2020-05-07 18:51:39 +00:00
committed by Commit Bot
parent 10c8f7db3d
commit d51e7703e7
52 changed files with 28 additions and 2188 deletions
android_webview/browser
chrome/browser
components
content
extensions/browser/api/messaging
weblayer/browser

@@ -76,7 +76,6 @@
#include "content/public/browser/browsing_data_remover.h"
#include "content/public/browser/child_process_security_policy.h"
#include "content/public/browser/favicon_status.h"
#include "content/public/browser/interstitial_page.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_frame_host.h"
@@ -1475,19 +1474,6 @@ void AwContents::DidFinishNavigation(
client->OnReceivedError(request, error_code, false, false);
}
void AwContents::DidAttachInterstitialPage() {
RenderFrameHost* rfh = web_contents_->GetInterstitialPage()->GetMainFrame();
browser_view_renderer_.SetActiveFrameSinkId(
rfh->GetRenderViewHost()->GetWidget()->GetFrameSinkId());
}
void AwContents::DidDetachInterstitialPage() {
if (!web_contents_)
return;
browser_view_renderer_.SetActiveFrameSinkId(
web_contents_->GetRenderViewHost()->GetWidget()->GetFrameSinkId());
}
bool AwContents::CanShowInterstitial() {
JNIEnv* env = AttachCurrentThread();
const ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);

@@ -391,8 +391,6 @@ class AwContents : public FindHelper::Listener,
content::RenderViewHost* new_host) override;
void DidFinishNavigation(
content::NavigationHandle* navigation_handle) override;
void DidAttachInterstitialPage() override;
void DidDetachInterstitialPage() override;
// AwSafeBrowsingUIManager::UIManagerClient implementation
bool CanShowInterstitial() override;

@@ -24,13 +24,11 @@
#include "components/security_interstitials/core/base_safe_browsing_error_ui.h"
#include "components/security_interstitials/core/safe_browsing_quiet_error_ui.h"
#include "components/security_interstitials/core/unsafe_resource.h"
#include "content/public/browser/interstitial_page.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/browser/web_contents.h"
#include "net/base/net_errors.h"
using content::InterstitialPage;
using content::WebContents;
using security_interstitials::BaseSafeBrowsingErrorUI;
using security_interstitials::SafeBrowsingQuietErrorUI;

@@ -9,7 +9,6 @@
#include "components/security_interstitials/content/security_interstitial_tab_helper.h"
#include "components/security_interstitials/content/ssl_blocking_page.h"
#include "components/security_interstitials/core/controller_client.h"
#include "content/public/browser/interstitial_page.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"

@@ -25,7 +25,6 @@
#include "chrome/browser/android/tab_android.h"
#include "chrome/browser/flags/android/chrome_feature_list.h"
#include "chrome/browser/thumbnail/cc/thumbnail.h"
#include "content/public/browser/interstitial_page.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host.h"
@@ -242,14 +241,6 @@ content::RenderWidgetHostView* TabContentManager::GetRwhvForTab(
DCHECK(web_contents);
content::RenderViewHost* rvh = web_contents->GetRenderViewHost();
if (web_contents->ShowingInterstitialPage()) {
if (!web_contents->GetInterstitialPage()->GetMainFrame())
return nullptr;
rvh = web_contents->GetInterstitialPage()
->GetMainFrame()
->GetRenderViewHost();
}
if (!rvh)
return nullptr;

@@ -48,7 +48,6 @@
#include "components/url_formatter/url_fixer.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/devtools_agent_host.h"
#include "content/public/browser/interstitial_page.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_frame_host.h"

@@ -6,7 +6,6 @@
#include "chrome/android/chrome_jni_headers/TabBrowserControlsConstraintsHelper_jni.h"
#include "chrome/common/chrome_render_frame.mojom.h"
#include "content/public/browser/interstitial_page.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/browser_controls_state.h"
@@ -45,12 +44,6 @@ void TabBrowserControlsConstraintsHelper::UpdateState(
DCHECK(web_contents);
web_contents->GetMainFrame()->UpdateBrowserControlsState(
constraints_state, current_state, animate);
if (web_contents->ShowingInterstitialPage()) {
web_contents->GetInterstitialPage()
->GetMainFrame()
->UpdateBrowserControlsState(constraints_state, current_state, animate);
}
}
static jlong JNI_TabBrowserControlsConstraintsHelper_Init(

@@ -64,7 +64,6 @@
#include "content/public/browser/ax_event_notification_details.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/gpu_data_manager.h"
#include "content/public/browser/interstitial_page.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"

@@ -151,7 +151,6 @@
#include "content/public/browser/child_process_data.h"
#include "content/public/browser/download_manager.h"
#include "content/public/browser/gpu_data_manager.h"
#include "content/public/browser/interstitial_page.h"
#include "content/public/browser/network_service_instance.h"
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_observer.h"

@@ -2553,7 +2553,6 @@ bool RenderViewContextMenu::IsTranslateEnabled() const {
0) &&
!original_lang.empty() && // Did we receive the page language yet?
!chrome_translate_client->GetLanguageState().IsPageTranslated() &&
!embedder_web_contents_->GetInterstitialPage() &&
// There are some application locales which can't be used as a
// target language for translation. In that case GetTargetLanguage()
// may return empty.

@@ -65,7 +65,6 @@
#include "components/security_state/core/security_state.h"
#include "components/strings/grit/components_strings.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/interstitial_page.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/notification_types.h"
@@ -90,7 +89,6 @@
using chrome_browser_interstitials::SecurityInterstitialIDNTest;
using content::BrowserThread;
using content::InterstitialPage;
using content::NavigationController;
using content::RenderFrameHost;
using content::WebContents;
@@ -614,11 +612,6 @@ class SafeBrowsingBlockingPageBrowserTest
security_interstitials::SecurityInterstitialCommand command) {
WebContents* contents =
browser()->tab_strip_model()->GetActiveWebContents();
// We use InterstitialPage::GetInterstitialPage(tab) instead of
// tab->GetInterstitialPage() because the tab doesn't have a pointer
// to its interstitial page until it gets a command from the renderer
// that it has indeed displayed it -- and this sometimes happens after
// NavigateToURL returns.
SafeBrowsingBlockingPage* interstitial_page;
security_interstitials::SecurityInterstitialTabHelper* helper =
security_interstitials::SecurityInterstitialTabHelper::FromWebContents(

@@ -81,7 +81,6 @@
#include "components/security_interstitials/core/controller_client.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/interstitial_page.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_service.h"
@@ -116,7 +115,6 @@
#endif
using content::BrowserThread;
using content::InterstitialPage;
using content::WebContents;
using ::testing::_;
using ::testing::Mock;

@@ -17,7 +17,6 @@
#include "components/safe_browsing/core/db/v4_test_util.h"
#include "components/safe_browsing/core/features.h"
#include "components/security_interstitials/content/security_interstitial_tab_helper.h"
#include "content/public/browser/interstitial_page.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/test_utils.h"

@@ -35,7 +35,6 @@
#include "components/javascript_dialogs/app_modal_dialog_view.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/interstitial_page.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/notification_types.h"

@@ -39,7 +39,6 @@
#include "components/security_state/core/security_state.h"
#include "components/variations/variations_params_manager.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/interstitial_page.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/browser_test.h"

@@ -63,7 +63,6 @@
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/file_select_listener.h"
#include "content/public/browser/interstitial_page.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/network_service_instance.h"

@@ -114,7 +114,6 @@
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/interstitial_page.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/navigation_handle.h"
@@ -4479,7 +4478,6 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, BadCertFollowedByGoodCert) {
ui_test_utils::NavigateToURL(browser(),
https_server_.GetURL("/ssl/google.html"));
ASSERT_FALSE(tab->GetInterstitialPage());
EXPECT_FALSE(state->HasAllowException(https_server_host, tab));
// Now check that subresource requests revoke the decision.

@@ -32,7 +32,6 @@
#include "components/infobars/core/infobar.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/pref_service.h"
#include "content/public/browser/interstitial_page.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/navigation_handle.h"
@@ -47,7 +46,6 @@
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "services/network/public/cpp/network_switches.h"
using content::InterstitialPage;
using content::NavigationController;
using content::NavigationEntry;
using content::WebContents;

@@ -30,7 +30,6 @@
#include "components/bookmarks/browser/url_and_title.h"
#include "components/bookmarks/test/bookmark_test_helpers.h"
#include "components/security_interstitials/content/security_interstitial_tab_helper.h"
#include "content/public/browser/interstitial_page.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/browser_test.h"

@@ -193,7 +193,6 @@
#include "components/zoom/zoom_controller.h"
#include "content/public/browser/devtools_agent_host.h"
#include "content/public/browser/file_select_listener.h"
#include "content/public/browser/interstitial_page.h"
#include "content/public/browser/invalidate_type.h"
#include "content/public/browser/keyboard_event_processing_result.h"
#include "content/public/browser/navigation_controller.h"
@@ -1093,10 +1092,6 @@ void Browser::MoveTabsToExistingWindow(const std::vector<int> tab_indices,
}
bool Browser::ShouldDisplayFavicon(content::WebContents* web_contents) const {
// No favicon on interstitials.
if (web_contents->ShowingInterstitialPage())
return false;
// Suppress the icon for the new-tab page, even if a navigation to it is
// not committed yet. Note that we're looking at the visible URL, so
// navigations from NTP generally don't hit this case and still show an icon.

@@ -40,7 +40,6 @@ IN_PROC_BROWSER_TEST_F(ExtensionsInternalsTest,
ASSERT_TRUE(web_contents);
EXPECT_EQ(navigation_url, web_contents->GetLastCommittedURL());
EXPECT_FALSE(web_contents->IsCrashed());
EXPECT_FALSE(web_contents->GetInterstitialPage());
// Look for a bit of JSON that has the extension's unique ID.
bool has_text = false;

@@ -36,7 +36,6 @@ IN_PROC_BROWSER_TEST_F(PrefsInternalsTest, TestPrefsAreServed) {
ASSERT_TRUE(web_contents);
EXPECT_EQ(kUrl, web_contents->GetLastCommittedURL());
EXPECT_FALSE(web_contents->IsCrashed());
EXPECT_FALSE(web_contents->GetInterstitialPage());
// It's difficult to test the content of the page without duplicating the
// implementation, but we can at least assert that something is being shown.

@@ -9,7 +9,6 @@
#include "base/location.h"
#include "base/single_thread_task_runner.h"
#include "base/threading/thread_task_runner_handle.h"
#include "content/public/browser/interstitial_page.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/web_contents.h"
@@ -279,11 +278,8 @@ void CaptivePortalTabReloader::ReloadTabIfNeeded() {
if (state_ != STATE_NEEDS_RELOAD)
return;
// If there's still a provisional load going, do nothing unless there's an
// interstitial page. Reloading when displaying an interstitial page will
// reload the underlying page, even if it hasn't yet committed.
if (provisional_main_frame_load_ &&
!content::InterstitialPage::GetInterstitialPage(web_contents_)) {
// If there's still a provisional load going, do nothing.
if (provisional_main_frame_load_) {
return;
}

@@ -9,7 +9,6 @@
#include "components/prefs/pref_service.h"
#include "components/safe_browsing/core/common/safe_browsing_prefs.h"
#include "components/security_interstitials/core/metrics_helper.h"
#include "content/public/browser/interstitial_page.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/referrer.h"
@@ -25,25 +24,17 @@ SecurityInterstitialControllerClient::SecurityInterstitialControllerClient(
const GURL& default_safe_page)
: ControllerClient(std::move(metrics_helper)),
web_contents_(web_contents),
interstitial_page_(nullptr),
prefs_(prefs),
app_locale_(app_locale),
default_safe_page_(default_safe_page) {}
SecurityInterstitialControllerClient::~SecurityInterstitialControllerClient() {}
void SecurityInterstitialControllerClient::set_interstitial_page(
content::InterstitialPage* interstitial_page) {
interstitial_page_ = interstitial_page;
}
content::InterstitialPage*
SecurityInterstitialControllerClient::interstitial_page() {
return interstitial_page_;
}
void SecurityInterstitialControllerClient::GoBack() {
interstitial_page_->DontProceed();
// TODO(crbug.com/1077074): This method is left so class can be non abstract
// since it is still instantiated in tests. This can be cleaned up by having
// tests use a subclass.
NOTREACHED();
}
bool SecurityInterstitialControllerClient::CanGoBack() {
@@ -64,7 +55,10 @@ void SecurityInterstitialControllerClient::GoBackAfterNavigationCommitted() {
}
void SecurityInterstitialControllerClient::Proceed() {
interstitial_page_->Proceed();
// TODO(crbug.com/1077074): This method is left so class can be non abstract
// since it is still instantiated in tests. This can be cleaned up by having
// tests use a subclass.
NOTREACHED();
}
void SecurityInterstitialControllerClient::Reload() {

@@ -10,7 +10,6 @@
#include "url/gurl.h"
namespace content {
class InterstitialPage;
class WebContents;
}
@@ -32,9 +31,6 @@ class SecurityInterstitialControllerClient
~SecurityInterstitialControllerClient() override;
void set_interstitial_page(content::InterstitialPage* interstitial_page);
content::InterstitialPage* interstitial_page();
// security_interstitials::ControllerClient overrides.
void GoBack() override;
bool CanGoBack() override;
@@ -55,7 +51,6 @@ class SecurityInterstitialControllerClient
content::WebContents* web_contents_;
private:
content::InterstitialPage* interstitial_page_;
PrefService* prefs_;
const std::string app_locale_;
// The default safe page we should go to if there is no previous page to go

@@ -897,10 +897,6 @@ jumbo_source_set("browser") {
"frame_host/frame_tree_node_blame_context.h",
"frame_host/input/input_injector_impl.cc",
"frame_host/input/input_injector_impl.h",
"frame_host/interstitial_page_impl.cc",
"frame_host/interstitial_page_impl.h",
"frame_host/interstitial_page_navigator_impl.cc",
"frame_host/interstitial_page_navigator_impl.h",
"frame_host/ipc_utils.cc",
"frame_host/ipc_utils.h",
"frame_host/keep_alive_handle_factory.cc",

@@ -31,13 +31,6 @@ ContentUiEventHandler::ContentUiEventHandler(JNIEnv* env,
RenderWidgetHostViewAndroid* ContentUiEventHandler::GetRenderWidgetHostView() {
RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView();
if (web_contents_->ShowingInterstitialPage()) {
rwhv = web_contents_->GetInterstitialPage()
->GetMainFrame()
->GetRenderViewHost()
->GetWidget()
->GetView();
}
return static_cast<RenderWidgetHostViewAndroid*>(rwhv);
}

@@ -4,7 +4,6 @@
#include "content/browser/android/render_widget_host_connector.h"
#include "content/browser/frame_host/interstitial_page_impl.h"
#include "content/browser/renderer_host/render_widget_host_view_android.h"
#include "content/browser/web_contents/web_contents_android.h"
#include "content/browser/web_contents/web_contents_impl.h"
@@ -75,10 +74,6 @@ void RenderWidgetHostConnector::Observer::RenderViewHostChanged(
RenderViewHost* old_host,
RenderViewHost* new_host) {
// |RenderViewHostChanged| is called only for main rwhva change.
// No need to update connection if an interstitial page is active.
if (web_contents()->ShowingInterstitialPage())
return;
auto* new_view = new_host ? static_cast<RenderWidgetHostViewBase*>(
new_host->GetWidget()->GetView())
: nullptr;
@@ -137,15 +132,6 @@ void RenderWidgetHostConnector::Observer::UpdateRenderWidgetHostView(
RenderWidgetHostViewAndroid*
RenderWidgetHostConnector::Observer::GetRenderWidgetHostViewAndroid() const {
RenderWidgetHostView* rwhv = web_contents()->GetRenderWidgetHostView();
WebContentsImpl* web_contents_impl =
static_cast<WebContentsImpl*>(web_contents());
if (web_contents_impl->ShowingInterstitialPage()) {
rwhv = web_contents_impl->GetInterstitialPage()
->GetMainFrame()
->GetRenderViewHost()
->GetWidget()
->GetView();
}
DCHECK(!rwhv || !static_cast<RenderWidgetHostViewBase*>(rwhv)
->IsRenderWidgetHostViewChildFrame());
return static_cast<RenderWidgetHostViewAndroid*>(rwhv);

File diff suppressed because it is too large Load Diff

@@ -1,337 +0,0 @@
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_BROWSER_FRAME_HOST_INTERSTITIAL_PAGE_IMPL_H_
#define CONTENT_BROWSER_FRAME_HOST_INTERSTITIAL_PAGE_IMPL_H_
#include <stdint.h>
#include <memory>
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/scoped_observer.h"
#include "build/build_config.h"
#include "content/browser/frame_host/frame_tree.h"
#include "content/browser/frame_host/navigator_delegate.h"
#include "content/browser/frame_host/render_frame_host_delegate.h"
#include "content/browser/renderer_host/render_view_host_delegate.h"
#include "content/browser/renderer_host/render_widget_host_delegate.h"
#include "content/public/browser/interstitial_page.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/render_widget_host.h"
#include "content/public/browser/render_widget_host_observer.h"
#include "content/public/browser/web_contents_observer.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "third_party/blink/public/mojom/renderer_preferences.mojom.h"
#include "url/gurl.h"
namespace content {
class NavigationControllerImpl;
class RenderViewHostImpl;
class RenderWidgetHostView;
class TextInputManager;
class WebContentsView;
namespace mojom {
class CreateNewWindowParams;
}
enum ResourceRequestAction { BLOCK, RESUME, CANCEL };
class CONTENT_EXPORT InterstitialPageImpl : public InterstitialPage,
public NotificationObserver,
public RenderFrameHostDelegate,
public RenderWidgetHostObserver,
public RenderViewHostDelegate,
public RenderWidgetHostDelegate,
public NavigatorDelegate {
public:
// The different state of actions the user can take in an interstitial.
enum ActionState {
NO_ACTION, // No action has been taken yet.
PROCEED_ACTION, // "Proceed" was selected.
DONT_PROCEED_ACTION // "Don't proceed" was selected.
};
InterstitialPageImpl(WebContents* web_contents,
RenderWidgetHostDelegate* render_widget_host_delegate,
bool new_navigation,
const GURL& url);
~InterstitialPageImpl() override;
// InterstitialPage implementation:
void Show() override;
void Hide() override;
void DontProceed() override;
void Proceed() override;
WebContents* GetWebContents() override;
RenderFrameHostImpl* GetMainFrame() override;
void DontCreateViewForTesting() override;
void SetSize(const gfx::Size& size) override;
void Focus() override;
// Allows the user to navigate away by disabling the interstitial, canceling
// the pending request, and unblocking the hidden renderer. The interstitial
// will stay visible until the navigation completes.
void CancelForNavigation();
// Focus the first (last if reverse is true) element in the interstitial page.
// Called when tab traversing.
void FocusThroughTabTraversal(bool reverse);
RenderWidgetHostView* GetView();
bool pause_throbber() const { return pause_throbber_; }
// TODO(nasko): This should move to InterstitialPageNavigatorImpl, but in
// the meantime make it public, so it can be called directly.
void DidNavigate(RenderViewHost* render_view_host,
const FrameHostMsg_DidCommitProvisionalLoad_Params& params);
// NavigatorDelegate implementation.
WebContents* OpenURL(const OpenURLParams& params) override;
const blink::UserAgentOverride& GetUserAgentOverride() override;
bool ShouldOverrideUserAgentForRendererInitiatedNavigation() override;
// RenderViewHostDelegate implementation:
FrameTree* GetFrameTree() override;
protected:
// NotificationObserver method:
void Observe(int type,
const NotificationSource& source,
const NotificationDetails& details) override;
// RenderFrameHostDelegate implementation:
bool OnMessageReceived(RenderFrameHostImpl* render_frame_host,
const IPC::Message& message) override;
void RenderFrameCreated(RenderFrameHost* render_frame_host) override;
void UpdateTitle(RenderFrameHost* render_frame_host,
const base::string16& title,
base::i18n::TextDirection title_direction) override;
InterstitialPage* GetAsInterstitialPage() override;
ui::AXMode GetAccessibilityMode() override;
void ExecuteEditCommand(const std::string& command,
const base::Optional<base::string16>& value) override;
void Undo() override;
void Redo() override;
void Cut() override;
void Copy() override;
void Paste() override;
void PasteAndMatchStyle() override;
void SelectAll() override;
RenderFrameHostDelegate* CreateNewWindow(
RenderFrameHost* opener,
const mojom::CreateNewWindowParams& params,
bool is_new_browsing_instance,
bool has_user_gesture,
SessionStorageNamespace* session_storage_namespace) override;
void ShowCreatedWindow(int process_id,
int main_frame_widget_route_id,
WindowOpenDisposition disposition,
const gfx::Rect& initial_rect,
bool user_gesture) override;
void SetFocusedFrame(FrameTreeNode* node, SiteInstance* source) override;
Visibility GetVisibility() override;
void AudioContextPlaybackStarted(RenderFrameHost* host,
int context_id) override;
void AudioContextPlaybackStopped(RenderFrameHost* host,
int context_id) override;
void CreateNewWidget(int32_t render_process_id,
int32_t route_id,
mojo::PendingRemote<mojom::Widget> widget,
mojo::PendingAssociatedReceiver<blink::mojom::WidgetHost>
blink_widget_host,
mojo::PendingAssociatedRemote<blink::mojom::Widget>
blink_widget) override;
void CreateNewFullscreenWidget(
int32_t render_process_id,
int32_t route_id,
mojo::PendingRemote<mojom::Widget> widget,
mojo::PendingAssociatedReceiver<blink::mojom::WidgetHost>
blink_widget_host,
mojo::PendingAssociatedRemote<blink::mojom::Widget> blink_widget)
override;
// RenderViewHostDelegate implementation:
RenderViewHostDelegateView* GetDelegateView() override;
bool OnMessageReceived(RenderViewHostImpl* render_view_host,
const IPC::Message& message) override;
const GURL& GetMainFrameLastCommittedURL() override;
void RenderViewTerminated(RenderViewHost* render_view_host,
base::TerminationStatus status,
int error_code) override;
blink::mojom::RendererPreferences GetRendererPrefs(
BrowserContext* browser_context) const override;
void ShowCreatedWidget(int process_id,
int route_id,
const gfx::Rect& initial_rect) override;
void ShowCreatedFullscreenWidget(int process_id, int route_id) override;
SessionStorageNamespace* GetSessionStorageNamespace(
SiteInstance* instance) override;
// RenderWidgetHostDelegate implementation:
void RenderWidgetDeleted(RenderWidgetHostImpl* render_widget_host) override;
KeyboardEventProcessingResult PreHandleKeyboardEvent(
const NativeWebKeyboardEvent& event) override;
bool PreHandleMouseEvent(const blink::WebMouseEvent& event) override;
bool HandleKeyboardEvent(const NativeWebKeyboardEvent& event) override;
TextInputManager* GetTextInputManager() override;
RenderWidgetHostInputEventRouter* GetInputEventRouter() override;
BrowserAccessibilityManager* GetRootBrowserAccessibilityManager() override;
BrowserAccessibilityManager* GetOrCreateRootBrowserAccessibilityManager()
override;
bool enabled() const { return enabled_; }
WebContents* web_contents() const;
const GURL& url() const { return url_; }
// Creates the WebContentsView that shows the interstitial RVH.
// Overriden in unit tests.
virtual WebContentsView* CreateWebContentsView();
// Notification magic.
NotificationRegistrar notification_registrar_;
private:
class InterstitialPageRVHDelegateView;
class UnderlyingContentObserver : public WebContentsObserver {
public:
UnderlyingContentObserver(WebContents* web_contents,
InterstitialPageImpl* interstitial);
// WebContentsObserver implementation:
void WebContentsDestroyed() override;
void NavigationEntryCommitted(
const LoadCommittedDetails& load_details) override;
// This observer does not override OnMessageReceived or otherwise handle
// messages from the underlying content, because the interstitial should not
// care about them. Messages from the interstitial page (which has its own
// FrameTree) arrive through the RenderFrameHostDelegate interface, not
// WebContentsObserver.
private:
InterstitialPageImpl* const interstitial_;
DISALLOW_COPY_AND_ASSIGN(UnderlyingContentObserver);
};
// RenderWidgetHostObserver implementation:
void RenderWidgetHostDestroyed(RenderWidgetHost* widget_host) override;
// Disable the interstitial:
// - if it is not yet showing, then it won't be shown.
// - any command sent by the RenderViewHost will be ignored.
void Disable();
// Delete ourselves, causing Shutdown on the RVH to be called.
void Shutdown();
void OnNavigatingAwayOrTabClosing();
// Executes the passed action on the ResourceDispatcher (on the IO thread).
// Used to block/resume/cancel requests for the RenderViewHost hidden by this
// interstitial.
void TakeActionOnResourceDispatcher(ResourceRequestAction action);
// IPC message handlers.
void OnDomOperationResponse(RenderFrameHostImpl* source,
const std::string& json_string);
// Creates the RenderViewHost containing the interstitial content.
RenderViewHostImpl* CreateRenderViewHost();
// Returns the focused frame's input handler.
mojom::FrameInputHandler* GetFocusedFrameInputHandler();
// Watches the underlying WebContents for reasons to cancel the interstitial.
UnderlyingContentObserver underlying_content_observer_;
// The contents in which we are displayed. This is valid until Hide is
// called, at which point it will be set to NULL because the WebContents
// itself may be deleted.
WebContents* web_contents_;
// The NavigationController for the content this page is being displayed over.
NavigationControllerImpl* controller_;
// Delegate for dispatching keyboard events and accessing the native view.
RenderWidgetHostDelegate* render_widget_host_delegate_;
// The URL that is shown when the interstitial is showing.
GURL url_;
// Whether this interstitial is shown as a result of a new navigation (in
// which case a transient navigation entry is created).
bool new_navigation_;
// Whether we should discard the pending navigation entry when not proceeding.
// This is to deal with cases where |new_navigation_| is true but a new
// pending entry was created since this interstitial was shown and we should
// not discard it.
bool should_discard_pending_nav_entry_;
// Whether this interstitial is enabled. See Disable() for more info.
bool enabled_;
// Whether the Proceed or DontProceed methods have been called yet.
ActionState action_taken_;
// The RenderViewHost displaying the interstitial contents. This is valid
// until Hide is called, at which point it will be set to NULL, signifying
// that shutdown has started.
// TODO(creis): This is now owned by the FrameTree. We should route things
// through the tree's root RenderFrameHost instead.
RenderViewHostImpl* render_view_host_;
// The frame tree structure of the current page.
std::unique_ptr<FrameTree> frame_tree_;
// The IDs for the Render[View|Process]Host hidden by this interstitial.
int original_child_id_;
int original_rvh_id_;
// Whether or not we should change the title of the contents when hidden (to
// revert it to its original value).
bool should_revert_web_contents_title_;
// Whether the ResourceDispatcherHost has been notified to cancel/resume the
// resource requests blocked for the RenderViewHost.
bool resource_dispatcher_host_notified_;
// The original title of the contents that should be reverted to when the
// interstitial is hidden.
base::string16 original_web_contents_title_;
// Our RenderViewHostDelegateView, necessary for accelerators to work.
std::unique_ptr<InterstitialPageRVHDelegateView> rvh_delegate_view_;
// Settings passed to the renderer.
mutable blink::mojom::RendererPreferences renderer_preferences_;
bool create_view_;
// Whether the throbber should be paused. This is true from the moment the
// interstitial is shown until the moment the interstitial goes away or the
// user chooses to proceed.
bool pause_throbber_;
scoped_refptr<SessionStorageNamespace> session_storage_namespace_;
ScopedObserver<RenderWidgetHost, RenderWidgetHostObserver> widget_observer_{
this};
base::WeakPtrFactory<InterstitialPageImpl> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(InterstitialPageImpl);
};
} // namespace content
#endif // CONTENT_BROWSER_FRAME_HOST_INTERSTITIAL_PAGE_IMPL_H_

@@ -1,57 +0,0 @@
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/browser/frame_host/interstitial_page_navigator_impl.h"
#include "content/browser/frame_host/interstitial_page_impl.h"
#include "content/browser/frame_host/navigation_controller_impl.h"
#include "content/browser/frame_host/navigator_delegate.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
namespace content {
InterstitialPageNavigatorImpl::InterstitialPageNavigatorImpl(
InterstitialPageImpl* interstitial,
NavigationControllerImpl* navigation_controller)
: interstitial_(interstitial),
controller_(navigation_controller),
enabled_(true) {}
InterstitialPageNavigatorImpl::~InterstitialPageNavigatorImpl() {}
NavigatorDelegate* InterstitialPageNavigatorImpl::GetDelegate() {
return interstitial_;
}
NavigationController* InterstitialPageNavigatorImpl::GetController() {
return controller_;
}
void InterstitialPageNavigatorImpl::DidNavigate(
RenderFrameHostImpl* render_frame_host,
const FrameHostMsg_DidCommitProvisionalLoad_Params& input_params,
std::unique_ptr<NavigationRequest> navigation_request,
bool was_within_same_document) {
// Do not proceed if the interstitial itself has been disabled.
if (!enabled_)
return;
navigation_request->DidCommitNavigation(input_params, true, false, GURL(),
NAVIGATION_TYPE_NEW_PAGE);
navigation_request.reset();
// TODO(nasko): Move implementation here, but for the time being call out
// to the interstitial page code.
interstitial_->DidNavigate(render_frame_host->render_view_host(),
input_params);
}
void InterstitialPageNavigatorImpl::Disable() {
enabled_ = false;
// This is no longer safe to access.
controller_ = nullptr;
}
} // namespace content

@@ -1,59 +0,0 @@
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_BROWSER_FRAME_HOST_INTERSTITIAL_PAGE_NAVIGATOR_IMPL_H_
#define CONTENT_BROWSER_FRAME_HOST_INTERSTITIAL_PAGE_NAVIGATOR_IMPL_H_
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "content/browser/frame_host/navigation_request.h"
#include "content/browser/frame_host/navigator.h"
#include "content/common/content_export.h"
namespace content {
class NavigationControllerImpl;
class InterstitialPageImpl;
// Navigator implementation specific to InterstitialPageImpl. It allows only one
// navigation to commit, since interstitial pages are not allowed to navigate.
class CONTENT_EXPORT InterstitialPageNavigatorImpl : public Navigator {
public:
InterstitialPageNavigatorImpl(
InterstitialPageImpl* interstitial,
NavigationControllerImpl* navigation_controller);
// Navigator implementation.
NavigatorDelegate* GetDelegate() override;
NavigationController* GetController() override;
void DidNavigate(
RenderFrameHostImpl* render_frame_host,
const FrameHostMsg_DidCommitProvisionalLoad_Params& input_params,
std::unique_ptr<NavigationRequest> navigation_request,
bool was_within_same_document) override;
// Disables any further action when the interstitial page is preparing to
// delete itself.
void Disable();
private:
~InterstitialPageNavigatorImpl() override;
// The InterstitialPage with which this navigator object is associated.
// Non owned pointer.
InterstitialPageImpl* interstitial_;
// The NavigationController associated with this navigator.
NavigationControllerImpl* controller_;
// Whether this interstitial is still enabled. Becomes false when the
// interstitial page is asychronously deleting itself.
bool enabled_;
DISALLOW_COPY_AND_ASSIGN(InterstitialPageNavigatorImpl);
};
} // namespace content
#endif // CONTENT_BROWSER_FRAME_HOST_INTERSTITIAL_PAGE_NAVIGATOR_IMPL_H_

@@ -17,9 +17,6 @@ namespace content {
struct LoadCommittedDetails;
class FrameTree;
class InterstitialPage;
class InterstitialPageImpl;
class RenderFrameHost;
class RenderViewHost;
class WebContents;
@@ -33,7 +30,6 @@ class NavigationControllerDelegate {
// Duplicates of WebContents methods.
virtual RenderViewHost* GetRenderViewHost() = 0;
virtual InterstitialPage* GetInterstitialPage() = 0;
virtual const std::string& GetContentsMimeType() = 0;
virtual void NotifyNavigationStateChanged(InvalidateTypes changed_flags) = 0;
virtual void Stop() = 0;
@@ -64,14 +60,7 @@ class NavigationControllerDelegate {
// embedder for NavigationController will be a WebContents object.
virtual WebContents* GetWebContents() = 0;
// Methods needed by InterstitialPageImpl.
virtual bool IsHidden() = 0;
virtual void RenderFrameForInterstitialPageCreated(
RenderFrameHost* render_frame_host) = 0;
virtual void AttachInterstitialPage(
InterstitialPageImpl* interstitial_page) = 0;
virtual void DidProceedOnInterstitial() = 0;
virtual void DetachInterstitialPage(bool has_focus) = 0;
virtual void UpdateOverridingUserAgent() = 0;
};

@@ -54,10 +54,11 @@
#include "content/browser/dom_storage/dom_storage_context_wrapper.h"
#include "content/browser/dom_storage/session_storage_namespace_impl.h"
#include "content/browser/frame_host/debug_urls.h"
#include "content/browser/frame_host/interstitial_page_impl.h"
#include "content/browser/frame_host/frame_tree.h"
#include "content/browser/frame_host/navigation_entry_impl.h"
#include "content/browser/frame_host/navigation_request.h"
#include "content/browser/frame_host/navigator.h"
#include "content/browser/frame_host/render_frame_host_delegate.h"
#include "content/browser/site_instance_impl.h"
#include "content/browser/web_package/web_bundle_navigation_info.h"
#include "content/common/content_constants_internal.h"
@@ -778,7 +779,7 @@ bool NavigationControllerImpl::CanViewSource() {
!media::IsSupportedMediaMimeType(mime_type);
NavigationEntry* visible_entry = GetVisibleEntry();
return visible_entry && !visible_entry->IsViewSourceMode() &&
is_viewable_mime_type && !delegate_->GetInterstitialPage();
is_viewable_mime_type;
}
int NavigationControllerImpl::GetLastCommittedEntryIndex() {
@@ -2665,19 +2666,6 @@ void NavigationControllerImpl::NavigateToExistingPendingEntry(
pending_entry_->GetTransitionType() & ui::PAGE_TRANSITION_FORWARD_BACK) {
delegate_->Stop();
// If an interstitial page is showing, we want to close it to get back to
// what was showing before.
//
// There are two ways to get the interstitial page given a WebContents.
// Because WebContents::GetInterstitialPage() returns null between the
// interstitial's Show() method being called and the interstitial becoming
// visible, while InterstitialPage::GetInterstitialPage() returns the
// interstitial during that time, use the latter.
InterstitialPage* interstitial =
InterstitialPage::GetInterstitialPage(GetWebContents());
if (interstitial)
interstitial->DontProceed();
DiscardNonCommittedEntries();
return;
}
@@ -2748,16 +2736,6 @@ void NavigationControllerImpl::NavigateToExistingPendingEntry(
}
}
// If an interstitial page is showing, the previous renderer is blocked and
// cannot make new requests. Unblock (and disable) it to allow this
// navigation to succeed. The interstitial will stay visible until the
// resulting DidNavigate.
// TODO(clamy): See if this can be removed. See https://crbug.com/849250.
if (delegate_->GetInterstitialPage()) {
static_cast<InterstitialPageImpl*>(delegate_->GetInterstitialPage())
->CancelForNavigation();
}
// This call does not support re-entrancy. See http://crbug.com/347742.
CHECK(!in_navigate_to_pending_entry_);
in_navigate_to_pending_entry_ = true;
@@ -2984,15 +2962,6 @@ void NavigationControllerImpl::NavigateWithoutEntry(
ValidateRequestMatchesEntry(request.get(), pending_entry_);
#endif
// If an interstitial page is showing, the previous renderer is blocked and
// cannot make new requests. Unblock (and disable) it to allow this
// navigation to succeed. The interstitial will stay visible until the
// resulting DidNavigate.
if (delegate_->GetInterstitialPage()) {
static_cast<InterstitialPageImpl*>(delegate_->GetInterstitialPage())
->CancelForNavigation();
}
// This call does not support re-entrancy. See http://crbug.com/347742.
CHECK(!in_navigate_to_pending_entry_);
in_navigate_to_pending_entry_ = true;

@@ -56,10 +56,6 @@ WebContents* RenderFrameHostDelegate::GetAsWebContents() {
return nullptr;
}
InterstitialPage* RenderFrameHostDelegate::GetAsInterstitialPage() {
return nullptr;
}
void RenderFrameHostDelegate::RequestMediaAccessPermission(
const MediaStreamRequest& request,
MediaResponseCallback callback) {

@@ -82,7 +82,6 @@ class ClipboardFormatType;
namespace content {
class FrameTreeNode;
class InterstitialPage;
class PageState;
class RenderFrameHostImpl;
class SessionStorageNamespace;
@@ -251,10 +250,6 @@ class CONTENT_EXPORT RenderFrameHostDelegate {
// not a WebContents, returns NULL.
virtual WebContents* GetAsWebContents();
// Returns this object cast to an InterstitialPage if it is one. Returns
// nullptr otherwise.
virtual InterstitialPage* GetAsInterstitialPage();
// The render frame has requested access to media devices listed in
// |request|, and the client should grant or deny that permission by
// calling |callback|.

@@ -7624,7 +7624,7 @@ bool RenderFrameHostImpl::ValidateDidCommitParams(
void RenderFrameHostImpl::UpdateSiteURL(const GURL& url,
bool url_is_unreachable) {
if (url_is_unreachable || delegate_->GetAsInterstitialPage()) {
if (url_is_unreachable) {
SetLastCommittedSiteUrl(GURL());
} else {
SetLastCommittedSiteUrl(url);
@@ -7660,18 +7660,11 @@ bool RenderFrameHostImpl::DidCommitNavigationInternal(
// same-document navigations.
is_commit_allowed_to_proceed |= is_same_document_navigation;
// 3) Transient interstitial page commits will not have a matching
// NavigationRequest.
// TODO(clamy): Enforce having a NavigationRequest for data URLs when
// committed interstitials have launched or interstitials create
// NavigationRequests.
is_commit_allowed_to_proceed |= !!delegate_->GetAsInterstitialPage();
// 4) Error pages implementations in Chrome can commit twice.
// 3) Error pages implementations in Chrome can commit twice.
// TODO(clamy): Fix this.
is_commit_allowed_to_proceed |= params->url_is_unreachable;
// 5) Special case for DOMSerializerBrowsertests which are implemented
// 4) Special case for DOMSerializerBrowsertests which are implemented
// entirely renderer-side and unlike normal RenderView based tests load
// file URLs instead of data URLs.
// TODO(clamy): Rework the tests to remove this exception.

@@ -26,11 +26,12 @@
#include "content/browser/devtools/render_frame_devtools_agent_host.h"
#include "content/browser/frame_host/debug_urls.h"
#include "content/browser/frame_host/frame_navigation_entry.h"
#include "content/browser/frame_host/interstitial_page_impl.h"
#include "content/browser/frame_host/frame_tree.h"
#include "content/browser/frame_host/navigation_controller_impl.h"
#include "content/browser/frame_host/navigation_entry_impl.h"
#include "content/browser/frame_host/navigation_request.h"
#include "content/browser/frame_host/navigator.h"
#include "content/browser/frame_host/render_frame_host_delegate.h"
#include "content/browser/frame_host/render_frame_host_factory.h"
#include "content/browser/frame_host/render_frame_host_impl.h"
#include "content/browser/frame_host/render_frame_proxy_host.h"
@@ -320,8 +321,6 @@ RenderViewHostImpl* RenderFrameHostManager::current_host() const {
}
RenderWidgetHostView* RenderFrameHostManager::GetRenderWidgetHostView() const {
if (delegate_->GetInterstitialForRenderManager())
return delegate_->GetInterstitialForRenderManager()->GetView();
if (render_frame_host_)
return render_frame_host_->GetView();
return nullptr;

@@ -32,7 +32,6 @@
namespace content {
class FrameTreeNode;
class InterstitialPageImpl;
class NavigationControllerImpl;
class NavigationEntry;
class NavigationRequest;
@@ -148,10 +147,6 @@ class CONTENT_EXPORT RenderFrameHostManager
RenderFrameHost* new_host) = 0;
virtual NavigationControllerImpl& GetControllerForRenderManager() = 0;
// Returns the interstitial page showing in the delegate, or null if there
// is none.
virtual InterstitialPageImpl* GetInterstitialForRenderManager() = 0;
// Returns true if the location bar should be focused by default rather than
// the page contents. The view calls this function when the tab is focused
// to see what it should do.

@@ -24,7 +24,6 @@
#include "content/browser/accessibility/browser_accessibility_android.h"
#include "content/browser/accessibility/browser_accessibility_manager_android.h"
#include "content/browser/android/java/gin_java_bridge_dispatcher_host.h"
#include "content/browser/frame_host/interstitial_page_impl.h"
#include "content/browser/media/media_web_contents_observer.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/web_contents/web_contents_impl.h"
@@ -385,13 +384,6 @@ RenderWidgetHostViewAndroid*
WebContentsAndroid::GetRenderWidgetHostViewAndroid() {
RenderWidgetHostView* rwhv = NULL;
rwhv = web_contents_->GetRenderWidgetHostView();
if (web_contents_->ShowingInterstitialPage()) {
rwhv = web_contents_->GetInterstitialPage()
->GetMainFrame()
->GetRenderViewHost()
->GetWidget()
->GetView();
}
return static_cast<RenderWidgetHostViewAndroid*>(rwhv);
}

@@ -59,7 +59,6 @@
#include "content/browser/find_request_manager.h"
#include "content/browser/frame_host/cross_process_frame_connector.h"
#include "content/browser/frame_host/frame_tree_node.h"
#include "content/browser/frame_host/interstitial_page_impl.h"
#include "content/browser/frame_host/navigation_entry_impl.h"
#include "content/browser/frame_host/navigation_request.h"
#include "content/browser/frame_host/navigator_impl.h"
@@ -582,7 +581,6 @@ WebContentsImpl::WebContentsImpl(BrowserContext* browser_context)
upload_size_(0),
upload_position_(0),
is_resume_pending_(false),
interstitial_page_(nullptr),
has_accessed_initial_document_(false),
visible_capturer_count_(0),
hidden_capturer_count_(0),
@@ -1454,8 +1452,7 @@ SiteInstanceImpl* WebContentsImpl::GetSiteInstance() {
}
bool WebContentsImpl::IsLoading() {
return frame_tree_.IsLoading() &&
!(ShowingInterstitialPage() && interstitial_page_->pause_throbber());
return frame_tree_.IsLoading();
}
double WebContentsImpl::GetLoadProgress() {
@@ -1757,11 +1754,6 @@ void WebContentsImpl::SetIgnoreInputEvents(bool ignore_input_events) {
void WebContentsImpl::SetMainFrameImportance(
ChildProcessImportance importance) {
GetMainFrame()->GetRenderWidgetHost()->SetImportance(importance);
if (ShowingInterstitialPage()) {
static_cast<RenderFrameHostImpl*>(interstitial_page_->GetMainFrame())
->GetRenderWidgetHost()
->SetImportance(importance);
}
}
#endif
@@ -2458,16 +2450,6 @@ RenderWidgetHostImpl* WebContentsImpl::GetFocusedRenderWidgetHost(
if (receiving_widget != GetMainFrame()->GetRenderWidgetHost())
return receiving_widget;
WebContentsImpl* focused_contents = GetFocusedWebContents();
// If the focused WebContents is showing an interstitial, return the
// interstitial's widget.
if (focused_contents->ShowingInterstitialPage()) {
return static_cast<RenderFrameHostImpl*>(
focused_contents->interstitial_page_->GetMainFrame())
->GetRenderWidgetHost();
}
// If the focused WebContents is a guest WebContents, then get the focused
// frame in the embedder WebContents instead.
FrameTreeNode* focused_frame =
@@ -2490,12 +2472,6 @@ RenderWidgetHostImpl* WebContentsImpl::GetFocusedRenderWidgetHost(
RenderWidgetHostImpl* WebContentsImpl::GetRenderWidgetHostWithPageFocus() {
WebContentsImpl* focused_web_contents = GetFocusedWebContents();
if (focused_web_contents->ShowingInterstitialPage()) {
return static_cast<RenderFrameHostImpl*>(
focused_web_contents->interstitial_page_->GetMainFrame())
->GetRenderWidgetHost();
}
return focused_web_contents->GetMainFrame()->GetRenderWidgetHost();
}
@@ -3448,15 +3424,6 @@ void WebContentsImpl::SendScreenRects() {
if (node->current_frame_host()->is_local_root())
node->current_frame_host()->GetRenderWidgetHost()->SendScreenRects();
}
// Interstitials have their own |frame_tree_|.
if (interstitial_page_) {
FrameTree* interstitial_frame_tree = interstitial_page_->GetFrameTree();
for (FrameTreeNode* node : interstitial_frame_tree->Nodes()) {
if (node->current_frame_host()->is_local_root())
node->current_frame_host()->GetRenderWidgetHost()->SendScreenRects();
}
}
}
TextInputManager* WebContentsImpl::GetTextInputManager() {
@@ -3484,17 +3451,13 @@ bool WebContentsImpl::IsWidgetForMainFrame(
BrowserAccessibilityManager*
WebContentsImpl::GetRootBrowserAccessibilityManager() {
RenderFrameHostImpl* rfh = static_cast<RenderFrameHostImpl*>(
ShowingInterstitialPage() ? GetInterstitialPage()->GetMainFrame()
: GetMainFrame());
RenderFrameHostImpl* rfh = static_cast<RenderFrameHostImpl*>(GetMainFrame());
return rfh ? rfh->browser_accessibility_manager() : nullptr;
}
BrowserAccessibilityManager*
WebContentsImpl::GetOrCreateRootBrowserAccessibilityManager() {
RenderFrameHostImpl* rfh = static_cast<RenderFrameHostImpl*>(
ShowingInterstitialPage() ? GetInterstitialPage()->GetMainFrame()
: GetMainFrame());
RenderFrameHostImpl* rfh = static_cast<RenderFrameHostImpl*>(GetMainFrame());
return rfh ? rfh->GetOrCreateBrowserAccessibilityManager() : nullptr;
}
@@ -3605,126 +3568,6 @@ WebContents* WebContentsImpl::OpenURL(const OpenURLParams& params) {
return new_contents;
}
void WebContentsImpl::RenderFrameForInterstitialPageCreated(
RenderFrameHost* render_frame_host) {
for (auto& observer : observers_)
observer.RenderFrameForInterstitialPageCreated(render_frame_host);
}
void WebContentsImpl::AttachInterstitialPage(
InterstitialPageImpl* interstitial_page) {
DCHECK(!interstitial_page_ && interstitial_page);
interstitial_page_ = interstitial_page;
// Cancel any visible dialogs so that they don't interfere with the
// interstitial.
CancelActiveAndPendingDialogs();
for (auto& observer : observers_)
observer.DidAttachInterstitialPage();
// Stop the throbber if needed while the interstitial page is shown.
if (frame_tree_.IsLoading())
LoadingStateChanged(true, true, nullptr);
// Connect to outer WebContents if necessary.
if (node_.OuterContentsFrameTreeNode()) {
if (GetRenderManager()->GetProxyToOuterDelegate()) {
DCHECK(
static_cast<RenderWidgetHostViewBase*>(interstitial_page->GetView())
->IsRenderWidgetHostViewChildFrame());
RenderWidgetHostViewChildFrame* view =
static_cast<RenderWidgetHostViewChildFrame*>(
interstitial_page->GetView());
GetRenderManager()->SetRWHViewForInnerContents(view);
}
}
#if defined(OS_ANDROID)
// Update importance of the interstitial.
static_cast<RenderFrameHostImpl*>(interstitial_page_->GetMainFrame())
->GetRenderWidgetHost()
->SetImportance(GetMainFrame()->GetRenderWidgetHost()->importance());
#endif
if (accessibility_mode_.has_mode(ui::AXMode::kNativeAPIs)) {
// Make sure that the main page's accessibility tree is hidden and the
// interstitial gets focus.
RenderFrameHostImpl* rfh =
static_cast<RenderFrameHostImpl*>(GetMainFrame());
if (rfh) {
BrowserAccessibilityManager* accessibility_manager =
rfh->browser_accessibility_manager();
if (accessibility_manager)
accessibility_manager->set_hidden_by_interstitial_page(true);
}
rfh = static_cast<RenderFrameHostImpl*>(
GetInterstitialPage()->GetMainFrame());
if (rfh) {
BrowserAccessibilityManager* accessibility_manager =
rfh->GetOrCreateBrowserAccessibilityManager();
if (accessibility_manager)
accessibility_manager->OnWindowFocused();
}
}
}
void WebContentsImpl::DidProceedOnInterstitial() {
// The interstitial page should no longer be pausing the throbber.
DCHECK(!(ShowingInterstitialPage() && interstitial_page_->pause_throbber()));
// Restart the throbber now that the interstitial page no longer pauses it.
if (ShowingInterstitialPage() && frame_tree_.IsLoading())
LoadingStateChanged(true, true, nullptr);
}
void WebContentsImpl::DetachInterstitialPage(bool has_focus) {
bool interstitial_pausing_throbber =
ShowingInterstitialPage() && interstitial_page_->pause_throbber();
if (ShowingInterstitialPage())
interstitial_page_ = nullptr;
// Make sure that the main page's accessibility tree is no longer
// suppressed.
RenderFrameHostImpl* rfh = GetMainFrame();
if (rfh) {
BrowserAccessibilityManager* accessibility_manager =
rfh->browser_accessibility_manager();
if (accessibility_manager)
accessibility_manager->set_hidden_by_interstitial_page(false);
}
// If the focus was on the interstitial, let's keep it to the page.
// (Note that in unit-tests the RVH may not have a view).
if (has_focus && GetRenderViewHost()->GetWidget()->GetView())
GetRenderViewHost()->GetWidget()->GetView()->Focus();
for (auto& observer : observers_)
observer.DidDetachInterstitialPage();
// Disconnect from outer WebContents if necessary. This must happen after the
// interstitial page is cleared above, since the call to
// SetRWHViewForInnerContents below may loop over all the
// RenderWidgetHostViews in the tree (otherwise, including the now-deleted
// view for the interstitial).
if (node_.OuterContentsFrameTreeNode()) {
if (GetRenderManager()->GetProxyToOuterDelegate()) {
DCHECK(static_cast<RenderWidgetHostViewBase*>(
GetRenderManager()->current_frame_host()->GetView())
->IsRenderWidgetHostViewChildFrame());
RenderWidgetHostViewChildFrame* view =
static_cast<RenderWidgetHostViewChildFrame*>(
GetRenderManager()->current_frame_host()->GetView());
GetRenderManager()->SetRWHViewForInnerContents(view);
}
}
// Restart the throbber if needed now that the interstitial page is going
// away.
if (interstitial_pausing_throbber && frame_tree_.IsLoading())
LoadingStateChanged(true, true, nullptr);
}
void WebContentsImpl::SetHistoryOffsetAndLength(int history_offset,
int history_length) {
SendPageMessage(new PageMsg_SetHistoryOffsetAndLength(
@@ -3938,11 +3781,7 @@ void WebContentsImpl::FocusThroughTabTraversal(bool reverse) {
}
bool WebContentsImpl::ShowingInterstitialPage() {
return interstitial_page_ != nullptr;
}
InterstitialPageImpl* WebContentsImpl::GetInterstitialPage() {
return interstitial_page_;
return false;
}
bool WebContentsImpl::IsSavable() {
@@ -5369,12 +5208,6 @@ void WebContentsImpl::LoadingStateChanged(bool to_different_document,
LoadNotificationDetails* details) {
if (is_being_destroyed_)
return;
// Do not send notifications about loading changes in the FrameTree while the
// interstitial page is pausing the throbber.
if (ShowingInterstitialPage() && interstitial_page_->pause_throbber() &&
!due_to_interstitial) {
return;
}
bool is_loading = IsLoading();
@@ -6407,13 +6240,7 @@ void WebContentsImpl::SetAsFocusedWebContentsIfNecessary() {
// focused which would return early without actually advancing focus.
FocusOuterAttachmentFrameChain();
if (ShowingInterstitialPage()) {
static_cast<RenderFrameHostImpl*>(interstitial_page_->GetMainFrame())
->GetRenderWidgetHost()
->SetPageFocus(true);
} else {
GetMainFrame()->GetRenderWidgetHost()->SetPageFocus(true);
}
GetMainFrame()->GetRenderWidgetHost()->SetPageFocus(true);
}
void WebContentsImpl::SetFocusedFrame(FrameTreeNode* node,
@@ -6718,10 +6545,6 @@ std::unique_ptr<WebUIImpl> WebContentsImpl::CreateWebUIForRenderFrameHost(
return CreateWebUI(url);
}
InterstitialPageImpl* WebContentsImpl::GetInterstitialForRenderManager() {
return interstitial_page_;
}
void WebContentsImpl::CreateRenderWidgetHostViewForRenderManager(
RenderViewHost* render_view_host) {
RenderWidgetHostViewBase* rwh_view =

@@ -31,7 +31,6 @@
#include "content/browser/frame_host/file_chooser_impl.h"
#include "content/browser/frame_host/frame_tree.h"
#include "content/browser/frame_host/frame_tree_node.h"
#include "content/browser/frame_host/interstitial_page_impl.h"
#include "content/browser/frame_host/navigation_controller_delegate.h"
#include "content/browser/frame_host/navigation_controller_impl.h"
#include "content/browser/frame_host/navigator_delegate.h"
@@ -100,7 +99,6 @@ class BrowserPluginGuest;
class ConversionHost;
class DisplayCutoutHostImpl;
class FindRequestManager;
class InterstitialPageImpl;
class JavaScriptDialogManager;
class JavaScriptDialogNavigationDeferrer;
class ManifestManagerHost;
@@ -459,7 +457,6 @@ class CONTENT_EXPORT WebContentsImpl : public WebContents,
void RestoreFocus() override;
void FocusThroughTabTraversal(bool reverse) override;
bool ShowingInterstitialPage() override;
InterstitialPageImpl* GetInterstitialPage() override;
bool IsSavable() override;
void OnSavePage() override;
bool SavePage(const base::FilePath& main_file,
@@ -971,7 +968,6 @@ class CONTENT_EXPORT WebContentsImpl : public WebContents,
RenderFrameHost* old_host,
RenderFrameHost* new_host) override;
NavigationControllerImpl& GetControllerForRenderManager() override;
InterstitialPageImpl* GetInterstitialForRenderManager() override;
bool FocusLocationBarByDefault() override;
void SetFocusToLocationBar() override;
bool IsHidden() override;
@@ -1022,24 +1018,10 @@ class CONTENT_EXPORT WebContentsImpl : public WebContents,
void SetHistoryOffsetAndLength(int history_offset,
int history_length) override;
// Called by InterstitialPageImpl when it creates a RenderFrameHost.
void RenderFrameForInterstitialPageCreated(
RenderFrameHost* render_frame_host) override;
// Sets the passed interstitial as the currently showing interstitial.
// No interstitial page should already be attached.
void AttachInterstitialPage(InterstitialPageImpl* interstitial_page) override;
void MediaMutedStatusChanged(const MediaPlayerId& id, bool muted);
// Unsets the currently showing interstitial.
void DetachInterstitialPage(bool has_focus) override;
void UpdateOverridingUserAgent() override;
// Unpause the throbber if it was paused.
void DidProceedOnInterstitial() override;
// Forces overscroll to be disabled (used by touch emulation).
void SetForceDisableOverscrollContent(bool force_disable);
@@ -1756,12 +1738,6 @@ class CONTENT_EXPORT WebContentsImpl : public WebContents,
// See ResumeLoadingCreatedWebContents.
bool is_resume_pending_;
// The interstitial page currently shown, if any. Not owned by this class: the
// InterstitialPage is self-owned and deletes itself asynchronously when
// hidden. Because it may outlive this WebContents, it enters a disabled state
// when hidden or preparing for destruction.
InterstitialPageImpl* interstitial_page_;
// Data for current page -----------------------------------------------------
// When a title cannot be taken from any entry, this title will be used.

@@ -16,7 +16,6 @@
#include "content/browser/android/gesture_listener_manager.h"
#include "content/browser/android/select_popup.h"
#include "content/browser/android/selection/selection_popup_controller.h"
#include "content/browser/frame_host/interstitial_page_impl.h"
#include "content/browser/renderer_host/display_util.h"
#include "content/browser/renderer_host/render_view_host_factory.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
@@ -118,18 +117,6 @@ void WebContentsViewAndroid::SetOverscrollRefreshHandler(
static_cast<RenderWidgetHostViewAndroid*>(rwhv)
->OnOverscrollRefreshHandlerAvailable();
}
if (web_contents_->ShowingInterstitialPage()) {
rwhv = web_contents_->GetInterstitialPage()
->GetMainFrame()
->GetRenderViewHost()
->GetWidget()
->GetView();
if (rwhv) {
static_cast<RenderWidgetHostViewAndroid*>(rwhv)
->OnOverscrollRefreshHandlerAvailable();
}
}
}
ui::OverscrollRefreshHandler*
@@ -154,13 +141,6 @@ RenderWidgetHostViewAndroid*
WebContentsViewAndroid::GetRenderWidgetHostViewAndroid() {
RenderWidgetHostView* rwhv = nullptr;
rwhv = web_contents_->GetRenderWidgetHostView();
if (web_contents_->ShowingInterstitialPage()) {
rwhv = web_contents_->GetInterstitialPage()
->GetMainFrame()
->GetRenderViewHost()
->GetWidget()
->GetView();
}
return static_cast<RenderWidgetHostViewAndroid*>(rwhv);
}
@@ -184,13 +164,9 @@ void WebContentsViewAndroid::SizeContents(const gfx::Size& size) {
}
void WebContentsViewAndroid::Focus() {
if (web_contents_->ShowingInterstitialPage()) {
web_contents_->GetInterstitialPage()->Focus();
} else {
auto* rwhv = web_contents_->GetRenderWidgetHostView();
if (rwhv)
static_cast<RenderWidgetHostViewAndroid*>(rwhv)->Focus();
}
auto* rwhv = web_contents_->GetRenderWidgetHostView();
if (rwhv)
static_cast<RenderWidgetHostViewAndroid*>(rwhv)->Focus();
}
void WebContentsViewAndroid::SetInitialFocus() {
@@ -209,10 +185,6 @@ void WebContentsViewAndroid::RestoreFocus() {
}
void WebContentsViewAndroid::FocusThroughTabTraversal(bool reverse) {
if (web_contents_->ShowingInterstitialPage()) {
web_contents_->GetInterstitialPage()->FocusThroughTabTraversal(reverse);
return;
}
content::RenderWidgetHostView* fullscreen_view =
web_contents_->GetFullscreenRenderWidgetHostView();
if (fullscreen_view) {
@@ -248,8 +220,7 @@ RenderWidgetHostViewBase* WebContentsViewAndroid::CreateViewForWidget(
// Note that while this instructs the render widget host to reference
// |native_view_|, this has no effect without also instructing the
// native view (i.e. ContentView) how to obtain a reference to this widget in
// order to paint it. See ContentView::GetRenderWidgetHostViewAndroid for an
// example of how this is achieved for InterstitialPages.
// order to paint it.
RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(render_widget_host);
auto* rwhv = new RenderWidgetHostViewAndroid(rwhi, &view_);
rwhv->SetSynchronousCompositorClient(synchronous_compositor_client_);

@@ -24,7 +24,6 @@
#include "components/viz/common/features.h"
#include "content/browser/browser_plugin/browser_plugin_guest.h"
#include "content/browser/download/drag_download_util.h"
#include "content/browser/frame_host/interstitial_page_impl.h"
#include "content/browser/frame_host/navigation_entry_impl.h"
#include "content/browser/renderer_host/dip_util.h"
#include "content/browser/renderer_host/input/touch_selection_controller_client_aura.h"
@@ -714,8 +713,6 @@ WebContentsViewAura::~WebContentsViewAura() {
}
void WebContentsViewAura::SizeChangedCommon(const gfx::Size& size) {
if (web_contents_->GetInterstitialPage())
web_contents_->GetInterstitialPage()->SetSize(size);
RenderWidgetHostView* rwhv =
web_contents_->GetRenderWidgetHostView();
if (rwhv)
@@ -838,11 +835,6 @@ void WebContentsViewAura::Focus() {
if (delegate_)
delegate_->ResetStoredFocus();
if (web_contents_->GetInterstitialPage()) {
web_contents_->GetInterstitialPage()->Focus();
return;
}
if (delegate_ && delegate_->Focus())
return;
@@ -879,10 +871,6 @@ void WebContentsViewAura::FocusThroughTabTraversal(bool reverse) {
if (delegate_)
delegate_->ResetStoredFocus();
if (web_contents_->ShowingInterstitialPage()) {
web_contents_->GetInterstitialPage()->FocusThroughTabTraversal(reverse);
return;
}
content::RenderWidgetHostView* fullscreen_view =
web_contents_->GetFullscreenRenderWidgetHostView();
if (fullscreen_view) {

@@ -28,7 +28,6 @@
#include "content/browser/web_contents/web_contents_impl.h"
#import "content/browser/web_contents/web_drag_dest_mac.h"
#include "content/common/web_contents_ns_view_bridge.mojom-shared.h"
#include "content/public/browser/interstitial_page.h"
#include "content/public/browser/web_contents_delegate.h"
#include "content/public/browser/web_contents_view_delegate.h"
#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
@@ -223,10 +222,6 @@ void WebContentsViewMac::FocusThroughTabTraversal(bool reverse) {
if (delegate())
delegate()->ResetStoredFocus();
if (web_contents_->ShowingInterstitialPage()) {
web_contents_->GetInterstitialPage()->FocusThroughTabTraversal(reverse);
return;
}
content::RenderWidgetHostView* fullscreen_view =
web_contents_->GetFullscreenRenderWidgetHostView();
if (fullscreen_view) {

@@ -195,7 +195,6 @@ jumbo_source_set("browser_sources") {
"idle_manager.h",
"installability_error.cc",
"installability_error.h",
"interstitial_page.h",
"invalidate_type.h",
"javascript_dialog_manager.cc",
"javascript_dialog_manager.h",

@@ -1,103 +0,0 @@
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_PUBLIC_BROWSER_INTERSTITIAL_PAGE_H_
#define CONTENT_PUBLIC_BROWSER_INTERSTITIAL_PAGE_H_
#include "content/common/content_export.h"
class GURL;
namespace gfx {
class Size;
}
namespace content {
class RenderFrameHost;
class WebContents;
// This class is used for showing interstitial pages, pages that show some
// informative message asking for user validation before reaching the target
// page. (Navigating to a page served over bad HTTPS or a page containing
// malware are typical cases where an interstitial is required.)
//
// If specified in the Create function, this class creates a navigation entry so
// that when the interstitial shows, the current entry is the target URL.
//
// InterstitialPage instances take care of deleting themselves when closed
// through a navigation, the WebContents closing them or the tab containing them
// being closed.
class InterstitialPage {
public:
// Creates an interstitial page to show in |web_contents|. |new_navigation|
// should be set to true when the interstitial is caused by loading a new
// page, in which case a temporary navigation entry is created with the URL
// |url| and added to the navigation controller (so the interstitial page
// appears as a new navigation entry). |new_navigation| should be false when
// the interstitial was triggered by a loading a sub-resource in a page. Takes
// ownership of |delegate|.
//
// Reloading the interstitial page will result in a new navigation to |url|.
CONTENT_EXPORT static InterstitialPage* Create(WebContents* web_contents,
bool new_navigation,
const GURL& url);
// Returns the InterstitialPage, if any, associated with the specified
// |web_contents|. Note: This returns a value from the time the interstitial
// page has Show() called on it.
//
// Compare to WebContents::GetInterstitialPage.
CONTENT_EXPORT static InterstitialPage* GetInterstitialPage(
WebContents* web_contents);
// Returns the InterstitialPage that hosts the RenderFrameHost, or nullptr if
// |rfh| is not a part of any InterstitialPage.
CONTENT_EXPORT static InterstitialPage* FromRenderFrameHost(
RenderFrameHost* rfh);
virtual ~InterstitialPage() {}
// Shows the interstitial page in the tab.
virtual void Show() = 0;
// Hides the interstitial page.
virtual void Hide() = 0;
// Reverts to the page showing before the interstitial.
// Delegates should call this method when the user has chosen NOT to proceed
// to the target URL.
// Warning: if |new_navigation| was set to true in the constructor, 'this'
// will be deleted when this method returns.
virtual void DontProceed() = 0;
// Delegates should call this method when the user has chosen to proceed to
// the target URL.
// Warning: 'this' has been deleted when this method returns.
virtual void Proceed() = 0;
// Sizes the RenderViewHost showing the actual interstitial page contents.
virtual void SetSize(const gfx::Size& size) = 0;
// Sets the focus to the interstitial.
virtual void Focus() = 0;
// Get the WebContents in which this interstitial is shown. Warning: Frames
// in the intersitital are NOT visible through WebContentObservers' normal
// notifications (e.g. RenderFrameDeleted). The only sensible use of this
// returned WebContents is to add a WebContentObserver and listen for the
// DidAttachInterstitialPage or DidDetachInterstitialPage notifications.
virtual WebContents* GetWebContents() = 0;
// Gets the RenderFrameHost associated with the interstitial page's main
// frame. May return nullptr if the interstitial is already hidden.
virtual RenderFrameHost* GetMainFrame() = 0;
virtual void DontCreateViewForTesting() = 0;
};
} // namespace content
#endif // CONTENT_PUBLIC_BROWSER_INTERSTITIAL_PAGE_H_

@@ -80,7 +80,6 @@ namespace content {
class BrowserContext;
class BrowserPluginGuestDelegate;
class InterstitialPage;
class RenderFrameHost;
class RenderViewHost;
class RenderWidgetHost;
@@ -775,14 +774,6 @@ class WebContents : public PageNavigator,
// Various other systems need to know about our interstitials.
virtual bool ShowingInterstitialPage() = 0;
// Returns the currently visible interstitial, nullptr if no interstitial is
// visible. Note: This returns nullptr from the time the interstitial page has
// Show() called on it until the interstitial content is ready and the
// interstitial is displayed.
//
// Compare to InterstitialPage::GetInterstitialPage.
virtual InterstitialPage* GetInterstitialPage() = 0;
// Misc state & callbacks ----------------------------------------------------
// Check whether we can do the saving page operation this page given its MIME

@@ -38,7 +38,6 @@
#include "content/browser/file_system/file_system_manager_impl.h"
#include "content/browser/frame_host/cross_process_frame_connector.h"
#include "content/browser/frame_host/frame_tree_node.h"
#include "content/browser/frame_host/interstitial_page_impl.h"
#include "content/browser/frame_host/navigation_request.h"
#include "content/browser/frame_host/render_frame_host_impl.h"
#include "content/browser/renderer_host/input/synthetic_touchscreen_pinch_gesture.h"
@@ -63,7 +62,6 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/child_process_termination_info.h"
#include "content/public/browser/histogram_fetcher.h"
#include "content/public/browser/interstitial_page.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/navigation_throttle.h"
@@ -2220,29 +2218,6 @@ void CancelKeyboardLock(WebContents* web_contents) {
render_widget_host_impl->CancelKeyboardLock();
}
bool IsInnerInterstitialPageConnected(InterstitialPage* interstitial_page) {
InterstitialPageImpl* impl =
static_cast<InterstitialPageImpl*>(interstitial_page);
RenderWidgetHostViewBase* rwhvb =
static_cast<RenderWidgetHostViewBase*>(impl->GetView());
EXPECT_TRUE(rwhvb->IsRenderWidgetHostViewChildFrame());
RenderWidgetHostViewChildFrame* rwhvcf =
static_cast<RenderWidgetHostViewChildFrame*>(rwhvb);
CrossProcessFrameConnector* frame_connector =
static_cast<CrossProcessFrameConnector*>(
rwhvcf->FrameConnectorForTesting());
WebContentsImpl* inner_web_contents =
static_cast<WebContentsImpl*>(impl->GetWebContents());
FrameTreeNode* outer_node = FrameTreeNode::GloballyFindByID(
inner_web_contents->GetOuterDelegateFrameTreeNodeId());
return outer_node->current_frame_host()->GetView() ==
frame_connector->GetParentRenderWidgetHostView();
}
ScreenOrientationDelegate* GetScreenOrientationDelegate() {
return ScreenOrientationProvider::GetDelegateForTesting();
}

@@ -99,7 +99,6 @@ namespace content {
class BrowserContext;
struct FrameVisualProperties;
class FrameTreeNode;
class InterstitialPage;
class NavigationHandle;
class NavigationRequest;
class RenderFrameMetadataProviderImpl;
@@ -985,10 +984,6 @@ bool RequestKeyboardLock(WebContents* web_contents,
base::Optional<base::flat_set<ui::DomCode>> codes);
void CancelKeyboardLock(WebContents* web_contents);
// Returns true if inner |interstitial_page| is connected to an outer
// WebContents.
bool IsInnerInterstitialPageConnected(InterstitialPage* interstitial_page);
// Returns the screen orientation provider that's been set via
// WebContents::SetScreenOrientationDelegate(). May return null.
ScreenOrientationDelegate* GetScreenOrientationDelegate();

@@ -11,7 +11,6 @@
#include "base/scoped_observer.h"
#include "base/strings/strcat.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/interstitial_page.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
@@ -160,28 +159,7 @@ ExtensionMessagePort::ExtensionMessagePort(
background_host_ptr_(nullptr),
frame_tracker_(new FrameTracker(this)) {
content::WebContents* tab = content::WebContents::FromRenderFrameHost(rfh);
if (!tab) {
content::InterstitialPage* interstitial =
content::InterstitialPage::FromRenderFrameHost(rfh);
// A RenderFrameHost must be hosted in a WebContents or InterstitialPage.
CHECK(interstitial);
// Only the main frame of an interstitial is supported, because frames in
// the interstitial do not trigger RenderFrameCreated / RenderFrameDeleted
// on WebContentObservers. Consequently, (1) we cannot detect removal of
// RenderFrameHosts, and (2) even if the RenderFrameDeleted is propagated,
// then WebContentsObserverSanityChecker triggers a CHECK when it detects
// frame notifications without a corresponding RenderFrameCreated.
if (!rfh->GetParent()) {
// It is safe to pass the interstitial's WebContents here because we only
// use it to observe DidDetachInterstitialPage.
frame_tracker_->TrackInterstitialFrame(interstitial->GetWebContents(),
rfh);
RegisterFrame(rfh);
}
return;
}
CHECK(tab);
frame_tracker_->TrackTabFrames(tab);
if (include_child_frames) {
tab->ForEachFrame(base::BindRepeating(&ExtensionMessagePort::RegisterFrame,

@@ -29,7 +29,6 @@
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/file_select_listener.h"
#include "content/public/browser/interstitial_page.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_frame_host.h"
@@ -530,12 +529,6 @@ void TabImpl::UpdateBrowserControlsState(JNIEnv* env, jint constraint) {
web_contents_->GetMainFrame()->UpdateBrowserControlsState(
state_constraint, current_state, animate);
if (web_contents_->ShowingInterstitialPage()) {
web_contents_->GetInterstitialPage()
->GetMainFrame()
->UpdateBrowserControlsState(state_constraint, current_state, animate);
}
}
ScopedJavaLocalRef<jstring> TabImpl::GetGuid(JNIEnv* env) {