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

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

Issue 2687353003: Created SerializableUserDataManager. (Closed)
Patch Set: Eugene's comments Created 3 years, 10 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
« no previous file with comments | « ios/web/web_state/web_state_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/logging.h" 10 #include "base/logging.h"
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "base/metrics/histogram_macros.h" 12 #include "base/metrics/histogram_macros.h"
13 #include "base/strings/sys_string_conversions.h" 13 #include "base/strings/sys_string_conversions.h"
14 #import "ios/web/interstitials/web_interstitial_impl.h" 14 #import "ios/web/interstitials/web_interstitial_impl.h"
15 #import "ios/web/navigation/crw_session_controller.h" 15 #import "ios/web/navigation/crw_session_controller.h"
16 #import "ios/web/navigation/crw_session_entry.h" 16 #import "ios/web/navigation/crw_session_entry.h"
17 #import "ios/web/navigation/navigation_item_impl.h" 17 #import "ios/web/navigation/navigation_item_impl.h"
18 #import "ios/web/navigation/navigation_manager_storage_builder.h" 18 #import "ios/web/navigation/session_storage_builder.h"
19 #include "ios/web/public/browser_state.h" 19 #include "ios/web/public/browser_state.h"
20 #import "ios/web/public/crw_navigation_manager_storage.h" 20 #import "ios/web/public/crw_session_storage.h"
21 #import "ios/web/public/image_fetcher/image_data_fetcher.h" 21 #import "ios/web/public/image_fetcher/image_data_fetcher.h"
22 #import "ios/web/public/java_script_dialog_presenter.h" 22 #import "ios/web/public/java_script_dialog_presenter.h"
23 #import "ios/web/public/navigation_item.h" 23 #import "ios/web/public/navigation_item.h"
24 #include "ios/web/public/url_util.h" 24 #include "ios/web/public/url_util.h"
25 #import "ios/web/public/web_client.h" 25 #import "ios/web/public/web_client.h"
26 #import "ios/web/public/web_state/context_menu_params.h" 26 #import "ios/web/public/web_state/context_menu_params.h"
27 #include "ios/web/public/web_state/credential.h" 27 #include "ios/web/public/web_state/credential.h"
28 #import "ios/web/public/web_state/ui/crw_content_view.h" 28 #import "ios/web/public/web_state/ui/crw_content_view.h"
29 #import "ios/web/public/web_state/web_state_delegate.h" 29 #import "ios/web/public/web_state/web_state_delegate.h"
30 #include "ios/web/public/web_state/web_state_observer.h" 30 #include "ios/web/public/web_state/web_state_observer.h"
(...skipping 28 matching lines...) Expand all
59 web_state->GetNavigationManagerImpl().InitializeSession( 59 web_state->GetNavigationManagerImpl().InitializeSession(
60 window_name, opener_id, opened_by_dom, opener_navigation_index); 60 window_name, opener_id, opened_by_dom, opener_navigation_index);
61 61
62 // This std::move is required to compile with the version of clang shipping 62 // This std::move is required to compile with the version of clang shipping
63 // with Xcode 8.0+. Evalute whether the issue is fixed once a new version of 63 // with Xcode 8.0+. Evalute whether the issue is fixed once a new version of
64 // Xcode is released. 64 // Xcode is released.
65 return std::move(web_state); 65 return std::move(web_state);
66 } 66 }
67 67
68 /* static */ 68 /* static */
69 std::unique_ptr<WebState> WebState::Create( 69 std::unique_ptr<WebState> WebState::Create(const CreateParams& params,
70 const CreateParams& params, 70 CRWSessionStorage* session_storage) {
71 CRWNavigationManagerStorage* session_storage) {
72 std::unique_ptr<WebStateImpl> web_state( 71 std::unique_ptr<WebStateImpl> web_state(
73 new WebStateImpl(params.browser_state, session_storage)); 72 new WebStateImpl(params.browser_state, session_storage));
74 73
75 // This std::move is required to compile with the version of clang shipping 74 // This std::move is required to compile with the version of clang shipping
76 // with Xcode 8.0+. Evalute whether the issue is fixed once a new version of 75 // with Xcode 8.0+. Evalute whether the issue is fixed once a new version of
77 // Xcode is released. 76 // Xcode is released.
78 return std::move(web_state); 77 return std::move(web_state);
79 } 78 }
80 79
81 WebStateImpl::WebStateImpl(BrowserState* browser_state) 80 WebStateImpl::WebStateImpl(BrowserState* browser_state)
82 : WebStateImpl(browser_state, nullptr) {} 81 : WebStateImpl(browser_state, nullptr) {}
83 82
84 WebStateImpl::WebStateImpl(BrowserState* browser_state, 83 WebStateImpl::WebStateImpl(BrowserState* browser_state,
85 CRWNavigationManagerStorage* session_storage) 84 CRWSessionStorage* session_storage)
86 : delegate_(nullptr), 85 : delegate_(nullptr),
87 is_loading_(false), 86 is_loading_(false),
88 is_being_destroyed_(false), 87 is_being_destroyed_(false),
89 facade_delegate_(nullptr), 88 facade_delegate_(nullptr),
90 web_controller_(nil), 89 web_controller_(nil),
91 interstitial_(nullptr), 90 interstitial_(nullptr),
92 weak_factory_(this) { 91 weak_factory_(this) {
93 // Create or deserialize the NavigationManager. 92 // Create or deserialize the NavigationManager.
94 if (session_storage) { 93 if (session_storage) {
95 NavigationManagerStorageBuilder session_storage_builder; 94 SessionStorageBuilder session_storage_builder;
96 navigation_manager_ = 95 session_storage_builder.ExtractSessionState(this, session_storage);
97 session_storage_builder.BuildNavigationManagerImpl(session_storage);
98 } else { 96 } else {
99 navigation_manager_.reset(new NavigationManagerImpl()); 97 navigation_manager_.reset(new NavigationManagerImpl());
100 } 98 }
101 navigation_manager_->SetDelegate(this); 99 navigation_manager_->SetDelegate(this);
102 navigation_manager_->SetBrowserState(browser_state); 100 navigation_manager_->SetBrowserState(browser_state);
103 // Send creation event and create the web controller. 101 // Send creation event and create the web controller.
104 GlobalWebStateEventTracker::GetInstance()->OnWebStateCreated(this); 102 GlobalWebStateEventTracker::GetInstance()->OnWebStateCreated(this);
105 web_controller_.reset([[CRWWebController alloc] initWithWebState:this]); 103 web_controller_.reset([[CRWWebController alloc] initWithWebState:this]);
106 // Set up the image fetcher. 104 // Set up the image fetcher.
107 image_fetcher_ = 105 image_fetcher_ =
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 } 647 }
650 648
651 const NavigationManager* WebStateImpl::GetNavigationManager() const { 649 const NavigationManager* WebStateImpl::GetNavigationManager() const {
652 return &GetNavigationManagerImpl(); 650 return &GetNavigationManagerImpl();
653 } 651 }
654 652
655 NavigationManager* WebStateImpl::GetNavigationManager() { 653 NavigationManager* WebStateImpl::GetNavigationManager() {
656 return &GetNavigationManagerImpl(); 654 return &GetNavigationManagerImpl();
657 } 655 }
658 656
659 CRWNavigationManagerStorage* WebStateImpl::BuildSerializedNavigationManager() { 657 CRWSessionStorage* WebStateImpl::BuildSessionStorage() {
660 NavigationManagerStorageBuilder session_storage_builder; 658 SessionStorageBuilder session_storage_builder;
661 return session_storage_builder.BuildStorage(navigation_manager_.get()); 659 return session_storage_builder.BuildStorage(this);
662 } 660 }
663 661
664 CRWJSInjectionReceiver* WebStateImpl::GetJSInjectionReceiver() const { 662 CRWJSInjectionReceiver* WebStateImpl::GetJSInjectionReceiver() const {
665 return [web_controller_ jsInjectionReceiver]; 663 return [web_controller_ jsInjectionReceiver];
666 } 664 }
667 665
668 void WebStateImpl::ExecuteJavaScript(const base::string16& javascript) { 666 void WebStateImpl::ExecuteJavaScript(const base::string16& javascript) {
669 [web_controller_ executeJavaScript:base::SysUTF16ToNSString(javascript) 667 [web_controller_ executeJavaScript:base::SysUTF16ToNSString(javascript)
670 completionHandler:nil]; 668 completionHandler:nil];
671 } 669 }
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 const LoadCommittedDetails& load_details) { 765 const LoadCommittedDetails& load_details) {
768 for (auto& observer : observers_) 766 for (auto& observer : observers_)
769 observer.NavigationItemCommitted(load_details); 767 observer.NavigationItemCommitted(load_details);
770 } 768 }
771 769
772 WebState* WebStateImpl::GetWebState() { 770 WebState* WebStateImpl::GetWebState() {
773 return this; 771 return this;
774 } 772 }
775 773
776 } // namespace web 774 } // namespace web
OLDNEW
« no previous file with comments | « 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