diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-08 21:53:13 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-08 21:53:13 +0000 |
commit | cadaec593e7979bfe86521f5300664ff396ca37f (patch) | |
tree | b2d5720e08ac2b19fe1f1c34c8df4fdfe44a329c /content/public | |
parent | 5bbc87042e45aee1152f79f97e55dd42dee07cb2 (diff) | |
download | chromium_src-cadaec593e7979bfe86521f5300664ff396ca37f.zip chromium_src-cadaec593e7979bfe86521f5300664ff396ca37f.tar.gz chromium_src-cadaec593e7979bfe86521f5300664ff396ca37f.tar.bz2 |
Add an API around InterstitialPage that's used by chrome.
BUG=98716
Review URL: https://chromiumcodereview.appspot.com/9348064
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@121059 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/public')
-rw-r--r-- | content/public/browser/interstitial_page.h | 88 | ||||
-rw-r--r-- | content/public/browser/utility_process_host.h | 2 | ||||
-rw-r--r-- | content/public/browser/web_contents.h | 2 |
3 files changed, 90 insertions, 2 deletions
diff --git a/content/public/browser/interstitial_page.h b/content/public/browser/interstitial_page.h new file mode 100644 index 0000000..0e9a101 --- /dev/null +++ b/content/public/browser/interstitial_page.h @@ -0,0 +1,88 @@ +// 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_ +#pragma once + +#include "content/common/content_export.h" + +class GURL; +class RenderViewHost; + +namespace gfx { +class Size; +} + +namespace content { + +class InterstitialPageDelegate; +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 |tab|. |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|. + CONTENT_EXPORT static InterstitialPage* Create( + WebContents* tab, + bool new_navigation, + const GURL& url, + InterstitialPageDelegate* delegate); + + // Retrieves the InterstitialPage if any associated with the specified + // |web_contents| (used by ui tests). + CONTENT_EXPORT static InterstitialPage* GetInterstitialPage( + WebContents* web_contents); + + 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; + + virtual RenderViewHost* GetRenderViewHostForTesting() const = 0; + virtual InterstitialPageDelegate* GetDelegateForTesting() = 0; + virtual void DontCreateViewForTesting() = 0; +}; + +} // namespace content + +#endif // CONTENT_BROWSER_TAB_CONTENTS_INTERSTITIAL_PAGE_H_ diff --git a/content/public/browser/utility_process_host.h b/content/public/browser/utility_process_host.h index a965b96..5320818 100644 --- a/content/public/browser/utility_process_host.h +++ b/content/public/browser/utility_process_host.h @@ -32,7 +32,7 @@ class UtilityProcessHost : public IPC::Message::Sender, public base::SupportsWeakPtr<UtilityProcessHost> { public: // Used to create a utility process. - static CONTENT_EXPORT UtilityProcessHost* Create( + CONTENT_EXPORT static UtilityProcessHost* Create( UtilityProcessHostClient* client, BrowserThread::ID client_thread_id); diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h index 2811e1df..898b436 100644 --- a/content/public/browser/web_contents.h +++ b/content/public/browser/web_contents.h @@ -17,7 +17,6 @@ #include "ui/gfx/native_widget_types.h" #include "webkit/glue/window_open_disposition.h" -class InterstitialPage; class RenderViewHost; class RenderWidgetHostView; class SessionStorageNamespace; @@ -39,6 +38,7 @@ struct LoadStateWithParam; namespace content { class BrowserContext; +class InterstitialPage; class NavigationController; class RenderProcessHost; class WebContentsDelegate; |