| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/web_state/web_state_impl.h" | 5 #import "ios/web/web_state/web_state_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
| 13 #include "base/metrics/histogram_macros.h" | 13 #include "base/metrics/histogram_macros.h" |
| 14 #include "base/strings/sys_string_conversions.h" | 14 #include "base/strings/sys_string_conversions.h" |
| 15 #include "base/threading/sequenced_task_runner_handle.h" | 15 #include "base/threading/sequenced_task_runner_handle.h" |
| 16 #import "ios/web/interstitials/web_interstitial_impl.h" | 16 #import "ios/web/interstitials/web_interstitial_impl.h" |
| 17 #import "ios/web/navigation/crw_session_controller.h" | 17 #import "ios/web/navigation/crw_session_controller.h" |
| 18 #import "ios/web/navigation/legacy_navigation_manager_impl.h" | 18 #import "ios/web/navigation/legacy_navigation_manager_impl.h" |
| 19 #import "ios/web/navigation/navigation_item_impl.h" | 19 #import "ios/web/navigation/navigation_item_impl.h" |
| 20 #import "ios/web/navigation/session_storage_builder.h" | 20 #import "ios/web/navigation/session_storage_builder.h" |
| 21 #import "ios/web/navigation/web_view_navigation_proxy.h" |
| 22 #import "ios/web/navigation/web_view_navigation_proxy_impl.h" |
| 23 #import "ios/web/navigation/wk_based_navigation_manager_impl.h" |
| 21 #include "ios/web/public/browser_state.h" | 24 #include "ios/web/public/browser_state.h" |
| 22 #import "ios/web/public/crw_session_storage.h" | 25 #import "ios/web/public/crw_session_storage.h" |
| 23 #import "ios/web/public/java_script_dialog_presenter.h" | 26 #import "ios/web/public/java_script_dialog_presenter.h" |
| 24 #import "ios/web/public/navigation_item.h" | 27 #import "ios/web/public/navigation_item.h" |
| 25 #include "ios/web/public/url_util.h" | 28 #include "ios/web/public/url_util.h" |
| 26 #import "ios/web/public/web_client.h" | 29 #import "ios/web/public/web_client.h" |
| 27 #import "ios/web/public/web_state/context_menu_params.h" | 30 #import "ios/web/public/web_state/context_menu_params.h" |
| 28 #import "ios/web/public/web_state/ui/crw_content_view.h" | 31 #import "ios/web/public/web_state/ui/crw_content_view.h" |
| 29 #import "ios/web/public/web_state/web_state_delegate.h" | 32 #import "ios/web/public/web_state/web_state_delegate.h" |
| 30 #include "ios/web/public/web_state/web_state_interface_provider.h" | 33 #include "ios/web/public/web_state/web_state_interface_provider.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 web_controller_(nil), | 81 web_controller_(nil), |
| 79 interstitial_(nullptr), | 82 interstitial_(nullptr), |
| 80 created_with_opener_(params.created_with_opener), | 83 created_with_opener_(params.created_with_opener), |
| 81 weak_factory_(this) { | 84 weak_factory_(this) { |
| 82 // Create or deserialize the NavigationManager. | 85 // Create or deserialize the NavigationManager. |
| 83 if (session_storage) { | 86 if (session_storage) { |
| 84 SessionStorageBuilder session_storage_builder; | 87 SessionStorageBuilder session_storage_builder; |
| 85 session_storage_builder.ExtractSessionState(this, session_storage); | 88 session_storage_builder.ExtractSessionState(this, session_storage); |
| 86 } else { | 89 } else { |
| 87 navigation_manager_ = base::WrapUnique<NavigationManagerImpl>( | 90 navigation_manager_ = base::WrapUnique<NavigationManagerImpl>( |
| 88 new LegacyNavigationManagerImpl); | 91 web::GetWebClient()->IsSlimNavigationManagerEnabled() |
| 92 ? (NavigationManagerImpl*)(new WKBasedNavigationManagerImpl) |
| 93 : (NavigationManagerImpl*)(new LegacyNavigationManagerImpl)); |
| 89 certificate_policy_cache_ = | 94 certificate_policy_cache_ = |
| 90 base::MakeUnique<SessionCertificatePolicyCacheImpl>(); | 95 base::MakeUnique<SessionCertificatePolicyCacheImpl>(); |
| 91 } | 96 } |
| 92 navigation_manager_->SetDelegate(this); | 97 navigation_manager_->SetDelegate(this); |
| 93 navigation_manager_->SetBrowserState(params.browser_state); | 98 navigation_manager_->SetBrowserState(params.browser_state); |
| 94 // Send creation event and create the web controller. | 99 // Send creation event and create the web controller. |
| 95 GlobalWebStateEventTracker::GetInstance()->OnWebStateCreated(this); | 100 GlobalWebStateEventTracker::GetInstance()->OnWebStateCreated(this); |
| 96 web_controller_.reset([[CRWWebController alloc] initWithWebState:this]); | 101 web_controller_.reset([[CRWWebController alloc] initWithWebState:this]); |
| 97 } | 102 } |
| 98 | 103 |
| (...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 730 void WebStateImpl::OnNavigationItemCommitted( | 735 void WebStateImpl::OnNavigationItemCommitted( |
| 731 const LoadCommittedDetails& load_details) { | 736 const LoadCommittedDetails& load_details) { |
| 732 for (auto& observer : observers_) | 737 for (auto& observer : observers_) |
| 733 observer.NavigationItemCommitted(load_details); | 738 observer.NavigationItemCommitted(load_details); |
| 734 } | 739 } |
| 735 | 740 |
| 736 WebState* WebStateImpl::GetWebState() { | 741 WebState* WebStateImpl::GetWebState() { |
| 737 return this; | 742 return this; |
| 738 } | 743 } |
| 739 | 744 |
| 745 WebViewNavigationProxy* WebStateImpl::GetWebViewNavigationProxy() const { |
| 746 return [web_controller_ webViewNavigationProxy]; |
| 747 } |
| 748 |
| 740 } // namespace web | 749 } // namespace web |
| OLD | NEW |