Commit 21eb2224 authored by Gauthier Ambard's avatar Gauthier Ambard Committed by Commit Bot

[iOS] Restore the user agent only on iOS 13+

This CL restrict the user agent restoration to iOS 13 and further as
iOS 12 has an issue getting the right User Agent.

Bug: 1070593
Change-Id: Ie4570efcb9931ccb8662511b16a1298570f0a297
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2154189Reviewed-by: default avatarJustin Cohen <justincohen@chromium.org>
Commit-Queue: Gauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#760057}
parent 0a86fece
......@@ -741,12 +741,16 @@ void WKBasedNavigationManagerImpl::UnsafeRestore(
forward_items.push_back(std::move(items[index]));
}
if (@available(iOS 13, *)) {
AddRestoreCompletionCallback(
base::BindOnce(&WKBasedNavigationManagerImpl::RestoreItemsState,
base::Unretained(this), RestoreItemListType::kBackList,
std::move(back_items)));
AddRestoreCompletionCallback(base::BindOnce(
&WKBasedNavigationManagerImpl::RestoreItemsState, base::Unretained(this),
RestoreItemListType::kBackList, std::move(back_items)));
AddRestoreCompletionCallback(base::BindOnce(
&WKBasedNavigationManagerImpl::RestoreItemsState, base::Unretained(this),
RestoreItemListType::kForwardList, std::move(forward_items)));
&WKBasedNavigationManagerImpl::RestoreItemsState,
base::Unretained(this), RestoreItemListType::kForwardList,
std::move(forward_items)));
}
LoadURLWithParams(params);
......@@ -795,9 +799,11 @@ void WKBasedNavigationManagerImpl::RestoreItemsState(
void WKBasedNavigationManagerImpl::RestoreVisibleItemState() {
NavigationItemImpl* last_committed_item =
GetLastCommittedItemInCurrentOrRestoredSession();
if (@available(iOS 13, *)) {
if (restored_visible_item_ && last_committed_item) {
last_committed_item->RestoreStateFromItem(restored_visible_item_.get());
}
}
restored_visible_item_.reset();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment