| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef IOS_WEB_INTERSTITIALS_NATIVE_WEB_INTERSTITIAL_IMPL_H_ | 5 #ifndef IOS_WEB_INTERSTITIALS_NATIVE_WEB_INTERSTITIAL_IMPL_H_ |
| 6 #define IOS_WEB_INTERSTITIALS_NATIVE_WEB_INTERSTITIAL_IMPL_H_ | 6 #define IOS_WEB_INTERSTITIALS_NATIVE_WEB_INTERSTITIAL_IMPL_H_ |
| 7 | 7 |
| 8 #include "ios/web/interstitials/web_interstitial_impl.h" | 8 #include "ios/web/interstitials/web_interstitial_impl.h" |
| 9 | 9 |
| 10 #include "base/ios/weak_nsobject.h" | 10 #include "base/ios/weak_nsobject.h" |
| 11 #include "base/mac/scoped_nsobject.h" | 11 #include "base/mac/scoped_nsobject.h" |
| 12 | 12 |
| 13 namespace web { | 13 namespace web { |
| 14 | 14 |
| 15 class NativeWebInterstitialDelegate; | 15 class NativeWebInterstitialDelegate; |
| 16 | 16 |
| 17 // A concrete subclass of WebInterstitialImpl that is used to display | 17 // A concrete subclass of WebInterstitialImpl that is used to display |
| 18 // interstitials created via native views. | 18 // interstitials created via native views. |
| 19 class NativeWebInterstitialImpl : public WebInterstitialImpl { | 19 class NativeWebInterstitialImpl : public WebInterstitialImpl { |
| 20 public: | 20 public: |
| 21 NativeWebInterstitialImpl(WebStateImpl* web_state, | 21 NativeWebInterstitialImpl( |
| 22 bool new_navigation, | 22 WebStateImpl* web_state, |
| 23 const GURL& url, | 23 bool new_navigation, |
| 24 scoped_ptr<NativeWebInterstitialDelegate> delegate); | 24 const GURL& url, |
| 25 std::unique_ptr<NativeWebInterstitialDelegate> delegate); |
| 25 ~NativeWebInterstitialImpl() override; | 26 ~NativeWebInterstitialImpl() override; |
| 26 | 27 |
| 27 // WebInterstitialImpl implementation: | 28 // WebInterstitialImpl implementation: |
| 28 CRWContentView* GetContentView() const override; | 29 CRWContentView* GetContentView() const override; |
| 29 | 30 |
| 30 protected: | 31 protected: |
| 31 // WebInterstitialImpl implementation: | 32 // WebInterstitialImpl implementation: |
| 32 void PrepareForDisplay() override; | 33 void PrepareForDisplay() override; |
| 33 WebInterstitialDelegate* GetDelegate() const override; | 34 WebInterstitialDelegate* GetDelegate() const override; |
| 34 void EvaluateJavaScript(NSString* script, | 35 void EvaluateJavaScript(NSString* script, |
| 35 JavaScriptCompletion completionHandler) override; | 36 JavaScriptCompletion completionHandler) override; |
| 36 | 37 |
| 37 private: | 38 private: |
| 38 // The native interstitial delegate. | 39 // The native interstitial delegate. |
| 39 scoped_ptr<NativeWebInterstitialDelegate> delegate_; | 40 std::unique_ptr<NativeWebInterstitialDelegate> delegate_; |
| 40 // The transient content view containing interstitial content. | 41 // The transient content view containing interstitial content. |
| 41 base::scoped_nsobject<CRWContentView> content_view_; | 42 base::scoped_nsobject<CRWContentView> content_view_; |
| 42 }; | 43 }; |
| 43 | 44 |
| 44 } // namespace web | 45 } // namespace web |
| 45 | 46 |
| 46 #endif // IOS_WEB_INTERSTITIALS_NATIVE_WEB_INTERSTITIAL_IMPL_H_ | 47 #endif // IOS_WEB_INTERSTITIALS_NATIVE_WEB_INTERSTITIAL_IMPL_H_ |
| OLD | NEW |