| 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 #import "ios/web/interstitials/html_web_interstitial_impl.h" | 5 #import "ios/web/interstitials/html_web_interstitial_impl.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/logging.h" | 9 #include "base/logging.h" |
| 8 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
| 9 #include "ios/web/interstitials/web_interstitial_facade_delegate.h" | 11 #include "ios/web/interstitials/web_interstitial_facade_delegate.h" |
| 10 #include "ios/web/public/interstitials/web_interstitial_delegate.h" | 12 #include "ios/web/public/interstitials/web_interstitial_delegate.h" |
| 11 #include "ios/web/public/web_state/ui/crw_web_view_content_view.h" | 13 #include "ios/web/public/web_state/ui/crw_web_view_content_view.h" |
| 12 #import "ios/web/web_state/ui/crw_simple_web_view_controller.h" | 14 #import "ios/web/web_state/ui/crw_simple_web_view_controller.h" |
| 13 #include "ios/web/web_state/web_state_impl.h" | 15 #include "ios/web/web_state/web_state_impl.h" |
| 14 #import "ios/web/web_state/web_view_internal_creation_util.h" | 16 #import "ios/web/web_state/web_view_internal_creation_util.h" |
| 15 #import "net/base/mac/url_conversions.h" | 17 #import "net/base/mac/url_conversions.h" |
| 16 #include "ui/gfx/geometry/size.h" | 18 #include "ui/gfx/geometry/size.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 namespace web { | 62 namespace web { |
| 61 | 63 |
| 62 // static | 64 // static |
| 63 WebInterstitial* WebInterstitial::CreateHtmlInterstitial( | 65 WebInterstitial* WebInterstitial::CreateHtmlInterstitial( |
| 64 WebState* web_state, | 66 WebState* web_state, |
| 65 bool new_navigation, | 67 bool new_navigation, |
| 66 const GURL& url, | 68 const GURL& url, |
| 67 scoped_ptr<HtmlWebInterstitialDelegate> delegate) { | 69 scoped_ptr<HtmlWebInterstitialDelegate> delegate) { |
| 68 WebStateImpl* web_state_impl = static_cast<WebStateImpl*>(web_state); | 70 WebStateImpl* web_state_impl = static_cast<WebStateImpl*>(web_state); |
| 69 return new HtmlWebInterstitialImpl(web_state_impl, new_navigation, url, | 71 return new HtmlWebInterstitialImpl(web_state_impl, new_navigation, url, |
| 70 delegate.Pass()); | 72 std::move(delegate)); |
| 71 } | 73 } |
| 72 | 74 |
| 73 HtmlWebInterstitialImpl::HtmlWebInterstitialImpl( | 75 HtmlWebInterstitialImpl::HtmlWebInterstitialImpl( |
| 74 WebStateImpl* web_state, | 76 WebStateImpl* web_state, |
| 75 bool new_navigation, | 77 bool new_navigation, |
| 76 const GURL& url, | 78 const GURL& url, |
| 77 scoped_ptr<HtmlWebInterstitialDelegate> delegate) | 79 scoped_ptr<HtmlWebInterstitialDelegate> delegate) |
| 78 : WebInterstitialImpl(web_state, new_navigation, url), | 80 : WebInterstitialImpl(web_state, new_navigation, url), |
| 79 delegate_(delegate.Pass()) { | 81 delegate_(std::move(delegate)) { |
| 80 DCHECK(delegate_); | 82 DCHECK(delegate_); |
| 81 } | 83 } |
| 82 | 84 |
| 83 HtmlWebInterstitialImpl::~HtmlWebInterstitialImpl() { | 85 HtmlWebInterstitialImpl::~HtmlWebInterstitialImpl() { |
| 84 } | 86 } |
| 85 | 87 |
| 86 void HtmlWebInterstitialImpl::CommandReceivedFromWebView(NSString* command) { | 88 void HtmlWebInterstitialImpl::CommandReceivedFromWebView(NSString* command) { |
| 87 delegate_->CommandReceived(base::SysNSStringToUTF8(command)); | 89 delegate_->CommandReceived(base::SysNSStringToUTF8(command)); |
| 88 } | 90 } |
| 89 | 91 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 117 } | 119 } |
| 118 | 120 |
| 119 void HtmlWebInterstitialImpl::EvaluateJavaScript( | 121 void HtmlWebInterstitialImpl::EvaluateJavaScript( |
| 120 NSString* script, | 122 NSString* script, |
| 121 JavaScriptCompletion completionHandler) { | 123 JavaScriptCompletion completionHandler) { |
| 122 [web_view_controller_ evaluateJavaScript:script | 124 [web_view_controller_ evaluateJavaScript:script |
| 123 stringResultHandler:completionHandler]; | 125 stringResultHandler:completionHandler]; |
| 124 } | 126 } |
| 125 | 127 |
| 126 } // namespace web | 128 } // namespace web |
| OLD | NEW |