QUIC - cleanup changes to sync chromium tree with internal source.
[chromium-blink-merge.git] / ios / web / public / interstitials / web_interstitial.h
blob8a573c3a1264b70653d6494983dfec47095b276b
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef IOS_WEB_PUBLIC_INTERSTITIALS_WEB_INTERSTITIAL_H_
6 #define IOS_WEB_PUBLIC_INTERSTITIALS_WEB_INTERSTITIAL_H_
8 #include "base/memory/scoped_ptr.h"
10 class GURL;
12 namespace gfx {
13 class Size;
16 namespace web {
18 class HtmlWebInterstitialDelegate;
19 class NativeWebInterstitialDelegate;
20 class WebState;
22 // This class is used for showing interstitial pages, pages that show some
23 // informative message asking for user validation before reaching the target
24 // page. (Navigating to a page served over bad HTTPS or a page containing
25 // malware are typical cases where an interstitial is required.)
27 // WebInterstitial instances take care of deleting themselves when closed by the
28 // WebState or through a navigation.
29 class WebInterstitial {
30 public:
31 // Creates an interstitial page to show in |web_state|. Takes ownership of
32 // |delegate|. Reloading the interstitial page will result in a new navigation
33 // to |url|. The pointers returned by these functions are self-owning; they
34 // manage their own deletion after calling |Show()|.
35 static WebInterstitial* CreateHtmlInterstitial(
36 WebState* web_state,
37 const GURL& url,
38 scoped_ptr<HtmlWebInterstitialDelegate> delegate);
39 static WebInterstitial* CreateNativeInterstitial(
40 WebState* web_state,
41 const GURL& url,
42 scoped_ptr<NativeWebInterstitialDelegate> delegate);
44 // Retrieves the WebInterstitial if any associated with the specified
45 // |web_state|.
46 static WebInterstitial* GetWebInterstitial(WebState* web_state);
48 virtual ~WebInterstitial() {}
50 // Shows the interstitial page in the WebState.
51 virtual void Show() = 0;
53 // Hides the interstitial page.
54 virtual void Hide() = 0;
56 // Reverts to the page showing before the interstitial.
57 // Delegates should call this method when the user has chosen NOT to proceed
58 // to the target URL.
59 // Warning: 'this' has been deleted when this method returns.
60 virtual void DontProceed() = 0;
62 // Delegates should call this method when the user has chosen to proceed to
63 // the target URL.
64 // Warning: 'this' has been deleted when this method returns.
65 virtual void Proceed() = 0;
68 } // namespace web
70 #endif // IOS_WEB_PUBLIC_INTERSTITIALS_WEB_INTERSTITIAL_H_