| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_view/public/cwv_web_view.h" | 5 #import "ios/web_view/public/cwv_web_view.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #import "base/ios/weak_nsobject.h" | 10 #import "base/ios/weak_nsobject.h" |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "base/strings/sys_string_conversions.h" | 12 #include "base/strings/sys_string_conversions.h" |
| 13 #import "ios/web/public/navigation_manager.h" | 13 #import "ios/web/public/navigation_manager.h" |
| 14 #include "ios/web/public/referrer.h" | 14 #include "ios/web/public/referrer.h" |
| 15 #include "ios/web/public/reload_type.h" | 15 #include "ios/web/public/reload_type.h" |
| 16 #import "ios/web/public/web_state/context_menu_params.h" | 16 #import "ios/web/public/web_state/context_menu_params.h" |
| 17 #import "ios/web/public/web_state/js/crw_js_injection_receiver.h" | 17 #import "ios/web/public/web_state/js/crw_js_injection_receiver.h" |
| 18 #import "ios/web/public/web_state/ui/crw_web_delegate.h" | 18 #import "ios/web/public/web_state/ui/crw_web_delegate.h" |
| 19 #import "ios/web/public/web_state/web_state.h" | 19 #import "ios/web/public/web_state/web_state.h" |
| 20 #import "ios/web/public/web_state/web_state_delegate_bridge.h" | 20 #import "ios/web/public/web_state/web_state_delegate_bridge.h" |
| 21 #import "ios/web/public/web_state/web_state_observer_bridge.h" | 21 #import "ios/web/public/web_state/web_state_observer_bridge.h" |
| 22 #import "ios/web_view/internal/cwv_html_element_internal.h" | 22 #import "ios/web_view/internal/cwv_html_element_internal.h" |
| 23 #import "ios/web_view/internal/cwv_website_data_store_internal.h" | 23 #import "ios/web_view/internal/cwv_web_view_configuration_internal.h" |
| 24 #import "ios/web_view/internal/translate/web_view_translate_client.h" | 24 #import "ios/web_view/internal/translate/web_view_translate_client.h" |
| 25 #include "ios/web_view/internal/web_view_browser_state.h" | 25 #include "ios/web_view/internal/web_view_browser_state.h" |
| 26 #import "ios/web_view/internal/web_view_java_script_dialog_presenter.h" | 26 #import "ios/web_view/internal/web_view_java_script_dialog_presenter.h" |
| 27 #import "ios/web_view/internal/web_view_web_state_policy_decider.h" | 27 #import "ios/web_view/internal/web_view_web_state_policy_decider.h" |
| 28 #import "ios/web_view/public/cwv_navigation_delegate.h" | 28 #import "ios/web_view/public/cwv_navigation_delegate.h" |
| 29 #import "ios/web_view/public/cwv_ui_delegate.h" | 29 #import "ios/web_view/public/cwv_ui_delegate.h" |
| 30 #import "ios/web_view/public/cwv_web_view_configuration.h" | 30 #import "ios/web_view/public/cwv_web_view_configuration.h" |
| 31 #import "ios/web_view/public/cwv_website_data_store.h" | |
| 32 #import "net/base/mac/url_conversions.h" | 31 #import "net/base/mac/url_conversions.h" |
| 33 #include "ui/base/page_transition_types.h" | 32 #include "ui/base/page_transition_types.h" |
| 34 #include "url/gurl.h" | 33 #include "url/gurl.h" |
| 35 | 34 |
| 36 @interface CWVWebView ()<CRWWebStateDelegate, CRWWebStateObserver> { | 35 @interface CWVWebView ()<CRWWebStateDelegate, CRWWebStateObserver> { |
| 37 CWVWebViewConfiguration* _configuration; | 36 CWVWebViewConfiguration* _configuration; |
| 38 std::unique_ptr<web::WebState> _webState; | 37 std::unique_ptr<web::WebState> _webState; |
| 39 std::unique_ptr<web::WebStateDelegateBridge> _webStateDelegate; | 38 std::unique_ptr<web::WebStateDelegateBridge> _webStateDelegate; |
| 40 std::unique_ptr<web::WebStateObserverBridge> _webStateObserver; | 39 std::unique_ptr<web::WebStateObserverBridge> _webStateObserver; |
| 41 std::unique_ptr<ios_web_view::WebViewWebStatePolicyDecider> | 40 std::unique_ptr<ios_web_view::WebViewWebStatePolicyDecider> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 59 @synthesize estimatedProgress = _estimatedProgress; | 58 @synthesize estimatedProgress = _estimatedProgress; |
| 60 @synthesize UIDelegate = _UIDelegate; | 59 @synthesize UIDelegate = _UIDelegate; |
| 61 | 60 |
| 62 - (instancetype)initWithFrame:(CGRect)frame | 61 - (instancetype)initWithFrame:(CGRect)frame |
| 63 configuration:(CWVWebViewConfiguration*)configuration { | 62 configuration:(CWVWebViewConfiguration*)configuration { |
| 64 self = [super initWithFrame:frame]; | 63 self = [super initWithFrame:frame]; |
| 65 if (self) { | 64 if (self) { |
| 66 _configuration = [configuration copy]; | 65 _configuration = [configuration copy]; |
| 67 | 66 |
| 68 web::WebState::CreateParams webStateCreateParams( | 67 web::WebState::CreateParams webStateCreateParams( |
| 69 [configuration.websiteDataStore browserState]); | 68 configuration.browserState); |
| 70 _webState = web::WebState::Create(webStateCreateParams); | 69 _webState = web::WebState::Create(webStateCreateParams); |
| 71 _webState->SetWebUsageEnabled(true); | 70 _webState->SetWebUsageEnabled(true); |
| 72 | 71 |
| 73 _webStateObserver = | 72 _webStateObserver = |
| 74 base::MakeUnique<web::WebStateObserverBridge>(_webState.get(), self); | 73 base::MakeUnique<web::WebStateObserverBridge>(_webState.get(), self); |
| 75 _webStateDelegate = base::MakeUnique<web::WebStateDelegateBridge>(self); | 74 _webStateDelegate = base::MakeUnique<web::WebStateDelegateBridge>(self); |
| 76 _webState->SetDelegate(_webStateDelegate.get()); | 75 _webState->SetDelegate(_webStateDelegate.get()); |
| 77 | 76 |
| 78 _webStatePolicyDecider = | 77 _webStatePolicyDecider = |
| 79 base::MakeUnique<ios_web_view::WebViewWebStatePolicyDecider>( | 78 base::MakeUnique<ios_web_view::WebViewWebStatePolicyDecider>( |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 userGestureLocation:params.location]; | 226 userGestureLocation:params.location]; |
| 228 return YES; | 227 return YES; |
| 229 } | 228 } |
| 230 | 229 |
| 231 - (web::JavaScriptDialogPresenter*)javaScriptDialogPresenterForWebState: | 230 - (web::JavaScriptDialogPresenter*)javaScriptDialogPresenterForWebState: |
| 232 (web::WebState*)webState { | 231 (web::WebState*)webState { |
| 233 return _javaScriptDialogPresenter.get(); | 232 return _javaScriptDialogPresenter.get(); |
| 234 } | 233 } |
| 235 | 234 |
| 236 @end | 235 @end |
| OLD | NEW |