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

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

Issue 1361173005: Created SerializedUserDataManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@serialized_navigation_manager
Patch Set: Eugene's comments Created 5 years, 2 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 #include "ios/web/web_state/web_state_impl.h" 5 #include "ios/web/web_state/web_state_impl.h"
6 6
7 #include "base/strings/sys_string_conversions.h" 7 #include "base/strings/sys_string_conversions.h"
8 #include "ios/web/interstitials/web_interstitial_impl.h" 8 #include "ios/web/interstitials/web_interstitial_impl.h"
9 #import "ios/web/navigation/crw_session_controller.h" 9 #import "ios/web/navigation/crw_session_controller.h"
10 #import "ios/web/navigation/crw_session_entry.h" 10 #import "ios/web/navigation/crw_session_entry.h"
11 #include "ios/web/navigation/navigation_item_impl.h" 11 #include "ios/web/navigation/navigation_item_impl.h"
12 #include "ios/web/net/request_group_util.h" 12 #include "ios/web/net/request_group_util.h"
13 #include "ios/web/public/browser_state.h" 13 #include "ios/web/public/browser_state.h"
14 #include "ios/web/public/navigation_item.h" 14 #include "ios/web/public/navigation_item.h"
15 #include "ios/web/public/serialized_user_data_manager.h"
15 #include "ios/web/public/url_util.h" 16 #include "ios/web/public/url_util.h"
16 #include "ios/web/public/web_client.h" 17 #include "ios/web/public/web_client.h"
17 #include "ios/web/public/web_state/credential.h" 18 #include "ios/web/public/web_state/credential.h"
18 #include "ios/web/public/web_state/ui/crw_content_view.h" 19 #include "ios/web/public/web_state/ui/crw_content_view.h"
19 #include "ios/web/public/web_state/web_state_observer.h" 20 #include "ios/web/public/web_state/web_state_observer.h"
20 #include "ios/web/public/web_state/web_state_policy_decider.h" 21 #include "ios/web/public/web_state/web_state_policy_decider.h"
21 #import "ios/web/web_state/ui/crw_web_controller.h" 22 #import "ios/web/web_state/ui/crw_web_controller.h"
22 #import "ios/web/web_state/ui/crw_web_controller_container_view.h" 23 #import "ios/web/web_state/ui/crw_web_controller_container_view.h"
23 #include "ios/web/web_state/web_state_facade_delegate.h" 24 #include "ios/web/web_state/web_state_facade_delegate.h"
24 #import "ios/web/webui/web_ui_ios_controller_factory_registry.h" 25 #import "ios/web/webui/web_ui_ios_controller_factory_registry.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 101
101 WebStateFacadeDelegate* WebStateImpl::GetFacadeDelegate() const { 102 WebStateFacadeDelegate* WebStateImpl::GetFacadeDelegate() const {
102 return facade_delegate_; 103 return facade_delegate_;
103 } 104 }
104 105
105 void WebStateImpl::SetFacadeDelegate(WebStateFacadeDelegate* facade_delegate) { 106 void WebStateImpl::SetFacadeDelegate(WebStateFacadeDelegate* facade_delegate) {
106 facade_delegate_ = facade_delegate; 107 facade_delegate_ = facade_delegate;
107 } 108 }
108 109
109 scoped_ptr<WebStateImpl> WebStateImpl::CopyForSerialization() const { 110 scoped_ptr<WebStateImpl> WebStateImpl::CopyForSerialization() const {
110 return scoped_ptr<WebStateImpl>(new WebStateImpl( 111 scoped_ptr<WebStateImpl> copy(new WebStateImpl(
111 GetBrowserState(), navigation_manager_->CopyForSerialization())); 112 GetBrowserState(), navigation_manager_->CopyForSerialization()));
113 // Copy the serialized user data and detach the user data thread so the newly
114 // created WebState can be serialized on another thread.
115 WebStateImpl* non_const_this = const_cast<WebStateImpl*>(this);
Eugene But (OOO till 7-30) 2015/09/24 21:39:25 This is a violation of API contract. This method p
116 SerializedUserDataManager* user_data_manager =
117 SerializedUserDataManager::FromWebState(non_const_this);
118 SerializedUserDataManager* copy_user_data_manager =
119 SerializedUserDataManager::FromWebState(copy.get());
120 copy_user_data_manager->AddValuesFromDictionary(
121 user_data_manager->GetSerializationDictionary());
122 copy->DetachUserDataThread();
123 return copy.Pass();
112 } 124 }
113 125
114 void WebStateImpl::OnUrlHashChanged() { 126 void WebStateImpl::OnUrlHashChanged() {
115 FOR_EACH_OBSERVER(WebStateObserver, observers_, UrlHashChanged()); 127 FOR_EACH_OBSERVER(WebStateObserver, observers_, UrlHashChanged());
116 } 128 }
117 129
118 void WebStateImpl::OnHistoryStateChanged() { 130 void WebStateImpl::OnHistoryStateChanged() {
119 FOR_EACH_OBSERVER(WebStateObserver, observers_, HistoryStateChanged()); 131 FOR_EACH_OBSERVER(WebStateObserver, observers_, HistoryStateChanged());
120 } 132 }
121 133
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 const LoadCommittedDetails& load_details) { 581 const LoadCommittedDetails& load_details) {
570 FOR_EACH_OBSERVER(WebStateObserver, observers_, 582 FOR_EACH_OBSERVER(WebStateObserver, observers_,
571 NavigationItemCommitted(load_details)); 583 NavigationItemCommitted(load_details));
572 } 584 }
573 585
574 WebState* WebStateImpl::GetWebState() { 586 WebState* WebStateImpl::GetWebState() {
575 return this; 587 return this;
576 } 588 }
577 589
578 } // namespace web 590 } // namespace web
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698