Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: ios/web/web_state/web_state_impl.mm

Issue 2957163002: [Navigation Experiment] Add WKBasedNavigationManagerImpl. (Closed)
Patch Set: Changed WebViewNavigationProxy to a protocol Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/wk_based_navigation_manager_impl.h"
21 #include "ios/web/public/browser_state.h" 22 #include "ios/web/public/browser_state.h"
22 #import "ios/web/public/crw_session_storage.h" 23 #import "ios/web/public/crw_session_storage.h"
23 #import "ios/web/public/java_script_dialog_presenter.h" 24 #import "ios/web/public/java_script_dialog_presenter.h"
24 #import "ios/web/public/navigation_item.h" 25 #import "ios/web/public/navigation_item.h"
25 #include "ios/web/public/url_util.h" 26 #include "ios/web/public/url_util.h"
26 #import "ios/web/public/web_client.h" 27 #import "ios/web/public/web_client.h"
27 #import "ios/web/public/web_state/context_menu_params.h" 28 #import "ios/web/public/web_state/context_menu_params.h"
28 #import "ios/web/public/web_state/ui/crw_content_view.h" 29 #import "ios/web/public/web_state/ui/crw_content_view.h"
29 #import "ios/web/public/web_state/web_state_delegate.h" 30 #import "ios/web/public/web_state/web_state_delegate.h"
30 #include "ios/web/public/web_state/web_state_interface_provider.h" 31 #include "ios/web/public/web_state/web_state_interface_provider.h"
31 #include "ios/web/public/web_state/web_state_observer.h" 32 #include "ios/web/public/web_state/web_state_observer.h"
32 #import "ios/web/public/web_state/web_state_policy_decider.h" 33 #import "ios/web/public/web_state/web_state_policy_decider.h"
33 #include "ios/web/public/web_thread.h" 34 #include "ios/web/public/web_thread.h"
34 #include "ios/web/public/webui/web_ui_ios_controller.h" 35 #include "ios/web/public/webui/web_ui_ios_controller.h"
35 #include "ios/web/web_state/global_web_state_event_tracker.h" 36 #include "ios/web/web_state/global_web_state_event_tracker.h"
36 #import "ios/web/web_state/navigation_context_impl.h" 37 #import "ios/web/web_state/navigation_context_impl.h"
37 #import "ios/web/web_state/session_certificate_policy_cache_impl.h" 38 #import "ios/web/web_state/session_certificate_policy_cache_impl.h"
38 #import "ios/web/web_state/ui/crw_web_controller.h" 39 #import "ios/web/web_state/ui/crw_web_controller.h"
39 #import "ios/web/web_state/ui/crw_web_controller_container_view.h" 40 #import "ios/web/web_state/ui/crw_web_controller_container_view.h"
41 #import "ios/web/web_state/ui/web_view_navigation_proxy.h"
40 #include "ios/web/webui/web_ui_ios_controller_factory_registry.h" 42 #include "ios/web/webui/web_ui_ios_controller_factory_registry.h"
41 #include "ios/web/webui/web_ui_ios_impl.h" 43 #include "ios/web/webui/web_ui_ios_impl.h"
42 #include "net/http/http_response_headers.h" 44 #include "net/http/http_response_headers.h"
43 #include "ui/gfx/image/image.h" 45 #include "ui/gfx/image/image.h"
44 46
45 namespace web { 47 namespace web {
46 48
47 /* static */ 49 /* static */
48 std::unique_ptr<WebState> WebState::Create(const CreateParams& params) { 50 std::unique_ptr<WebState> WebState::Create(const CreateParams& params) {
49 std::unique_ptr<WebStateImpl> web_state(new WebStateImpl(params)); 51 std::unique_ptr<WebStateImpl> web_state(new WebStateImpl(params));
(...skipping 23 matching lines...) Expand all
73 WebStateImpl::WebStateImpl(const CreateParams& params, 75 WebStateImpl::WebStateImpl(const CreateParams& params,
74 CRWSessionStorage* session_storage) 76 CRWSessionStorage* session_storage)
75 : delegate_(nullptr), 77 : delegate_(nullptr),
76 is_loading_(false), 78 is_loading_(false),
77 is_being_destroyed_(false), 79 is_being_destroyed_(false),
78 web_controller_(nil), 80 web_controller_(nil),
79 interstitial_(nullptr), 81 interstitial_(nullptr),
80 created_with_opener_(params.created_with_opener), 82 created_with_opener_(params.created_with_opener),
81 weak_factory_(this) { 83 weak_factory_(this) {
82 // Create or deserialize the NavigationManager. 84 // Create or deserialize the NavigationManager.
85 if (web::GetWebClient()->IsSlimNavigationManagerEnabled()) {
86 navigation_manager_ = base::WrapUnique<NavigationManagerImpl>(
Eugene But (OOO till 7-30) 2017/06/29 22:28:02 nit: Is it possible to use MakeUnique now?
danyao 2017/06/29 23:09:48 Yes. :)
87 new WKBasedNavigationManagerImpl);
88 } else {
89 navigation_manager_ = base::WrapUnique<NavigationManagerImpl>(
90 new LegacyNavigationManagerImpl);
91 }
92
83 if (session_storage) { 93 if (session_storage) {
84 SessionStorageBuilder session_storage_builder; 94 SessionStorageBuilder session_storage_builder;
85 session_storage_builder.ExtractSessionState(this, session_storage); 95 session_storage_builder.ExtractSessionState(this, session_storage);
86 } else { 96 } else {
87 navigation_manager_ = base::WrapUnique<NavigationManagerImpl>(
88 new LegacyNavigationManagerImpl);
89 certificate_policy_cache_ = 97 certificate_policy_cache_ =
90 base::MakeUnique<SessionCertificatePolicyCacheImpl>(); 98 base::MakeUnique<SessionCertificatePolicyCacheImpl>();
91 } 99 }
92 navigation_manager_->SetDelegate(this); 100 navigation_manager_->SetDelegate(this);
93 navigation_manager_->SetBrowserState(params.browser_state); 101 navigation_manager_->SetBrowserState(params.browser_state);
94 // Send creation event and create the web controller. 102 // Send creation event and create the web controller.
95 GlobalWebStateEventTracker::GetInstance()->OnWebStateCreated(this); 103 GlobalWebStateEventTracker::GetInstance()->OnWebStateCreated(this);
96 web_controller_.reset([[CRWWebController alloc] initWithWebState:this]); 104 web_controller_.reset([[CRWWebController alloc] initWithWebState:this]);
97 } 105 }
98 106
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 void WebStateImpl::OnNavigationItemCommitted( 738 void WebStateImpl::OnNavigationItemCommitted(
731 const LoadCommittedDetails& load_details) { 739 const LoadCommittedDetails& load_details) {
732 for (auto& observer : observers_) 740 for (auto& observer : observers_)
733 observer.NavigationItemCommitted(load_details); 741 observer.NavigationItemCommitted(load_details);
734 } 742 }
735 743
736 WebState* WebStateImpl::GetWebState() { 744 WebState* WebStateImpl::GetWebState() {
737 return this; 745 return this;
738 } 746 }
739 747
748 id<WebViewNavigationProxy> WebStateImpl::GetWebViewNavigationProxy() const {
749 return [web_controller_ webViewNavigationProxy];
750 }
751
740 } // namespace web 752 } // namespace web
OLDNEW
« ios/web/web_state/ui/web_view_navigation_proxy.h ('K') | « ios/web/web_state/web_state_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698