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 #include "ios/web/interstitials/native_web_interstitial_impl.h" | 5 #include "ios/web/interstitials/native_web_interstitial_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "ios/web/public/interstitials/web_interstitial_delegate.h" | 10 #include "ios/web/public/interstitials/web_interstitial_delegate.h" |
11 #import "ios/web/public/web_state/ui/crw_generic_content_view.h" | 11 #import "ios/web/public/web_state/ui/crw_generic_content_view.h" |
12 #include "ios/web/web_state/web_state_impl.h" | 12 #include "ios/web/web_state/web_state_impl.h" |
13 #include "ui/gfx/geometry/size.h" | 13 #include "ui/gfx/geometry/size.h" |
14 | 14 |
15 namespace web { | 15 namespace web { |
16 | 16 |
17 // static | 17 // static |
18 WebInterstitial* WebInterstitial::CreateNativeInterstitial( | 18 WebInterstitial* WebInterstitial::CreateNativeInterstitial( |
19 WebState* web_state, | 19 WebState* web_state, |
20 bool new_navigation, | 20 bool new_navigation, |
21 const GURL& url, | 21 const GURL& url, |
22 scoped_ptr<NativeWebInterstitialDelegate> delegate) { | 22 std::unique_ptr<NativeWebInterstitialDelegate> delegate) { |
23 WebStateImpl* web_state_impl = static_cast<WebStateImpl*>(web_state); | 23 WebStateImpl* web_state_impl = static_cast<WebStateImpl*>(web_state); |
24 return new NativeWebInterstitialImpl(web_state_impl, new_navigation, url, | 24 return new NativeWebInterstitialImpl(web_state_impl, new_navigation, url, |
25 std::move(delegate)); | 25 std::move(delegate)); |
26 } | 26 } |
27 | 27 |
28 NativeWebInterstitialImpl::NativeWebInterstitialImpl( | 28 NativeWebInterstitialImpl::NativeWebInterstitialImpl( |
29 WebStateImpl* web_state, | 29 WebStateImpl* web_state, |
30 bool new_navigation, | 30 bool new_navigation, |
31 const GURL& url, | 31 const GURL& url, |
32 scoped_ptr<NativeWebInterstitialDelegate> delegate) | 32 std::unique_ptr<NativeWebInterstitialDelegate> delegate) |
33 : web::WebInterstitialImpl(web_state, new_navigation, url), | 33 : web::WebInterstitialImpl(web_state, new_navigation, url), |
34 delegate_(std::move(delegate)) { | 34 delegate_(std::move(delegate)) { |
35 DCHECK(delegate_); | 35 DCHECK(delegate_); |
36 } | 36 } |
37 | 37 |
38 NativeWebInterstitialImpl::~NativeWebInterstitialImpl() { | 38 NativeWebInterstitialImpl::~NativeWebInterstitialImpl() { |
39 } | 39 } |
40 | 40 |
41 CRWContentView* NativeWebInterstitialImpl::GetContentView() const { | 41 CRWContentView* NativeWebInterstitialImpl::GetContentView() const { |
42 return content_view_.get(); | 42 return content_view_.get(); |
(...skipping 10 matching lines...) Expand all Loading... |
53 return delegate_.get(); | 53 return delegate_.get(); |
54 } | 54 } |
55 | 55 |
56 void NativeWebInterstitialImpl::EvaluateJavaScript( | 56 void NativeWebInterstitialImpl::EvaluateJavaScript( |
57 NSString* script, | 57 NSString* script, |
58 JavaScriptCompletion completionHandler) { | 58 JavaScriptCompletion completionHandler) { |
59 NOTREACHED() << "JavaScript cannot be evaluated on native interstitials."; | 59 NOTREACHED() << "JavaScript cannot be evaluated on native interstitials."; |
60 } | 60 } |
61 | 61 |
62 } // namespace web | 62 } // namespace web |
OLD | NEW |