Commit 6b52d0c9 authored by Carlos Caballero's avatar Carlos Caballero Committed by Commit Bot

Move reset state code to DidFinishNavigation

A navigation might start but not commit, that is the navigation fails
and the page will not change. A good example thereof is a navigation that
returns a 204. Still in this case some state will have been cleared in
the DidStartNavigation method. Which means the state shows does no
longer correspond to the page we are on.

There is really no reason to not wait until DidNavigationFinish to reset
all this state, so this patches does so. The only exception are cookies,
as these might get accessed during the navigation. A follow up patch will
take care of these.

Bug: 998171
Change-Id: I6146986a8b146128fad388da88f4fd2238571822
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1895512Reviewed-by: default avatarBalazs Engedy <engedy@chromium.org>
Reviewed-by: default avatarAlexander Timin <altimin@chromium.org>
Reviewed-by: default avatarAndy Paicu <andypaicu@chromium.org>
Commit-Queue: Andy Paicu <andypaicu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#746704}
parent f978b9cd
...@@ -753,10 +753,6 @@ void TabSpecificContentSettings::DidStartNavigation( ...@@ -753,10 +753,6 @@ void TabSpecificContentSettings::DidStartNavigation(
} }
ClearNavigationRelatedContentSettings(); ClearNavigationRelatedContentSettings();
ClearGeolocationContentSettings();
ClearMidiContentSettings();
ClearPendingProtocolHandler();
ClearContentSettingsChangedViaPageInfo();
} }
void TabSpecificContentSettings::ReadyToCommitNavigation( void TabSpecificContentSettings::ReadyToCommitNavigation(
...@@ -794,10 +790,11 @@ void TabSpecificContentSettings::DidFinishNavigation( ...@@ -794,10 +790,11 @@ void TabSpecificContentSettings::DidFinishNavigation(
return; return;
} }
// Clear "blocked" flags.
ClearContentSettingsExceptForNavigationRelatedSettings(); ClearContentSettingsExceptForNavigationRelatedSettings();
GeolocationDidNavigate(navigation_handle); GeolocationDidNavigate(navigation_handle);
MidiDidNavigate(navigation_handle); MidiDidNavigate(navigation_handle);
ClearPendingProtocolHandler();
ClearContentSettingsChangedViaPageInfo();
if (web_contents()->GetVisibleURL().SchemeIsHTTPOrHTTPS()) { if (web_contents()->GetVisibleURL().SchemeIsHTTPOrHTTPS()) {
content_settings::RecordPluginsAction( content_settings::RecordPluginsAction(
...@@ -833,26 +830,20 @@ void TabSpecificContentSettings::NotifySiteDataObservers() { ...@@ -833,26 +830,20 @@ void TabSpecificContentSettings::NotifySiteDataObservers() {
observer.OnSiteDataAccessed(); observer.OnSiteDataAccessed();
} }
void TabSpecificContentSettings::ClearGeolocationContentSettings() {
geolocation_usages_state_.ClearStateMap();
}
void TabSpecificContentSettings::ClearMidiContentSettings() {
midi_usages_state_.ClearStateMap();
}
void TabSpecificContentSettings::ClearContentSettingsChangedViaPageInfo() { void TabSpecificContentSettings::ClearContentSettingsChangedViaPageInfo() {
content_settings_changed_via_page_info_.clear(); content_settings_changed_via_page_info_.clear();
} }
void TabSpecificContentSettings::GeolocationDidNavigate( void TabSpecificContentSettings::GeolocationDidNavigate(
content::NavigationHandle* navigation_handle) { content::NavigationHandle* navigation_handle) {
geolocation_usages_state_.ClearStateMap();
geolocation_usages_state_.DidNavigate(navigation_handle->GetURL(), geolocation_usages_state_.DidNavigate(navigation_handle->GetURL(),
navigation_handle->GetPreviousURL()); navigation_handle->GetPreviousURL());
} }
void TabSpecificContentSettings::MidiDidNavigate( void TabSpecificContentSettings::MidiDidNavigate(
content::NavigationHandle* navigation_handle) { content::NavigationHandle* navigation_handle) {
midi_usages_state_.ClearStateMap();
midi_usages_state_.DidNavigate(navigation_handle->GetURL(), midi_usages_state_.DidNavigate(navigation_handle->GetURL(),
navigation_handle->GetPreviousURL()); navigation_handle->GetPreviousURL());
} }
......
...@@ -381,12 +381,6 @@ class TabSpecificContentSettings ...@@ -381,12 +381,6 @@ class TabSpecificContentSettings
// Notifies all registered |SiteDataObserver|s. // Notifies all registered |SiteDataObserver|s.
void NotifySiteDataObservers(); void NotifySiteDataObservers();
// Clears the Geolocation settings.
void ClearGeolocationContentSettings();
// Clears the MIDI settings.
void ClearMidiContentSettings();
// Clears settings changed by the user via PageInfo since the last navigation. // Clears settings changed by the user via PageInfo since the last navigation.
void ClearContentSettingsChangedViaPageInfo(); void ClearContentSettingsChangedViaPageInfo();
......
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