| 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 <memory> |
| 11 |
| 10 #include "base/ios/weak_nsobject.h" | 12 #include "base/ios/weak_nsobject.h" |
| 11 #include "base/mac/scoped_nsobject.h" | 13 #include "base/mac/scoped_nsobject.h" |
| 12 | 14 |
| 13 namespace web { | 15 namespace web { |
| 14 | 16 |
| 15 class NativeWebInterstitialDelegate; | 17 class NativeWebInterstitialDelegate; |
| 16 | 18 |
| 17 // A concrete subclass of WebInterstitialImpl that is used to display | 19 // A concrete subclass of WebInterstitialImpl that is used to display |
| 18 // interstitials created via native views. | 20 // interstitials created via native views. |
| 19 class NativeWebInterstitialImpl : public WebInterstitialImpl { | 21 class NativeWebInterstitialImpl : public WebInterstitialImpl { |
| 20 public: | 22 public: |
| 21 NativeWebInterstitialImpl(WebStateImpl* web_state, | 23 NativeWebInterstitialImpl( |
| 22 bool new_navigation, | 24 WebStateImpl* web_state, |
| 23 const GURL& url, | 25 bool new_navigation, |
| 24 scoped_ptr<NativeWebInterstitialDelegate> delegate); | 26 const GURL& url, |
| 27 std::unique_ptr<NativeWebInterstitialDelegate> delegate); |
| 25 ~NativeWebInterstitialImpl() override; | 28 ~NativeWebInterstitialImpl() override; |
| 26 | 29 |
| 27 // WebInterstitialImpl implementation: | 30 // WebInterstitialImpl implementation: |
| 28 CRWContentView* GetContentView() const override; | 31 CRWContentView* GetContentView() const override; |
| 29 | 32 |
| 30 protected: | 33 protected: |
| 31 // WebInterstitialImpl implementation: | 34 // WebInterstitialImpl implementation: |
| 32 void PrepareForDisplay() override; | 35 void PrepareForDisplay() override; |
| 33 WebInterstitialDelegate* GetDelegate() const override; | 36 WebInterstitialDelegate* GetDelegate() const override; |
| 34 void EvaluateJavaScript(NSString* script, | 37 void EvaluateJavaScript(NSString* script, |
| 35 JavaScriptCompletion completionHandler) override; | 38 JavaScriptCompletion completionHandler) override; |
| 36 | 39 |
| 37 private: | 40 private: |
| 38 // The native interstitial delegate. | 41 // The native interstitial delegate. |
| 39 scoped_ptr<NativeWebInterstitialDelegate> delegate_; | 42 std::unique_ptr<NativeWebInterstitialDelegate> delegate_; |
| 40 // The transient content view containing interstitial content. | 43 // The transient content view containing interstitial content. |
| 41 base::scoped_nsobject<CRWContentView> content_view_; | 44 base::scoped_nsobject<CRWContentView> content_view_; |
| 42 }; | 45 }; |
| 43 | 46 |
| 44 } // namespace web | 47 } // namespace web |
| 45 | 48 |
| 46 #endif // IOS_WEB_INTERSTITIALS_NATIVE_WEB_INTERSTITIAL_IMPL_H_ | 49 #endif // IOS_WEB_INTERSTITIALS_NATIVE_WEB_INTERSTITIAL_IMPL_H_ |
| OLD | NEW |