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_DELEGATE_H_
6 #define IOS_WEB_PUBLIC_INTERSTITIALS_WEB_INTERSTITIAL_DELEGATE_H_
20 // Superclass for delegates that provide data to a WebInterstitial. After the
21 // WebInterstitial is shown, it takes ownership of its delegate.
22 class WebInterstitialDelegate
{
24 virtual ~WebInterstitialDelegate() {}
26 // Called when the interstitial is proceeded or cancelled. Note that this may
27 // be called directly even if the embedder didn't call Proceed or DontProceed
28 // on WebInterstitial, since navigations etc may cancel them.
29 virtual void OnProceed() {}
30 virtual void OnDontProceed() {}
33 // Provides HTML to an HTMLWebInterstitialImpl.
34 class HtmlWebInterstitialDelegate
: public WebInterstitialDelegate
{
36 // Returns the HTML that should be displayed in the page.
37 virtual std::string
GetHtmlContents() const = 0;
39 // Invoked when a WebInterstitial receives a command via JavaScript.
40 virtual void CommandReceived(const std::string
& command
) {}
43 // Provides a native content view to NativeWebInterstitialImpls.
44 class NativeWebInterstitialDelegate
: public WebInterstitialDelegate
{
46 // Returns the content view for native interstitials.
47 virtual UIView
* GetContentView() = 0;
49 // The desired background color for the interstitial's scroll view.
50 virtual UIColor
* GetScrollViewBackgroundColor() const = 0;
55 #endif // IOS_WEB_PUBLIC_INTERSTITIALS_WEB_INTERSTITIAL_DELEGATE_H_