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_INTERSTITIALS_NATIVE_WEB_INTERSTITIAL_IMPL_H_
6 #define IOS_WEB_INTERSTITIALS_NATIVE_WEB_INTERSTITIAL_IMPL_H_
8 #include "ios/web/interstitials/web_interstitial_impl.h"
10 #include "base/ios/weak_nsobject.h"
11 #include "base/mac/scoped_nsobject.h"
15 class NativeWebInterstitialDelegate
;
17 // A concrete subclass of WebInterstitialImpl that is used to display
18 // interstitials created via native views.
19 class NativeWebInterstitialImpl
: public WebInterstitialImpl
{
21 NativeWebInterstitialImpl(WebStateImpl
* web_state
,
23 scoped_ptr
<NativeWebInterstitialDelegate
> delegate
);
24 ~NativeWebInterstitialImpl() override
;
26 // WebInterstitial implementation:
27 void SetSize(const gfx::Size
& size
) override
;
29 // WebInterstitialImpl implementation:
30 UIView
* GetView() const override
;
31 UIScrollView
* GetScrollView() const override
;
34 // WebInterstitialImpl implementation:
35 void PrepareForDisplay() override
;
36 WebInterstitialDelegate
* GetDelegate() const override
;
37 void EvaluateJavaScript(NSString
* script
,
38 JavaScriptCompletion completionHandler
) override
;
41 // The native interstitial delegate.
42 scoped_ptr
<NativeWebInterstitialDelegate
> delegate_
;
43 // The top-level view containing the scroll view.
44 base::scoped_nsobject
<UIView
> container_view_
;
45 // The scroll view used to display |content_view_|.
46 base::scoped_nsobject
<UIScrollView
> scroll_view_
;
47 // The content view provided by |delegate_|.
48 base::WeakNSObject
<UIView
> content_view_
;
53 #endif // IOS_WEB_INTERSTITIALS_NATIVE_WEB_INTERSTITIAL_IMPL_H_