Commit b8863cc0 authored by yilkal's avatar yilkal Committed by Commit Bot

Remove workaround for absent SupervisedUserNavigationObserver.

This cl removes the workaround for the absence of
SupervisedUserNavigationObserver even when the profile
of the WebContents is supervised. The workaround is removed
so that we can test the fix that landed in crrev/c/2102764
actually fixed the underlying issue.

Bug: 1061427
Change-Id: I3801c87779563fa7f76a38bb9e4403fa4c639ca8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2105623
Commit-Queue: Yilkal Abe <yilkal@chromium.org>
Commit-Queue: Mikel Astiz <mastiz@chromium.org>
Reviewed-by: default avatarMikel Astiz <mastiz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#750769}
parent 54aeff66
......@@ -130,13 +130,7 @@ TabContentsSyncedTabDelegate::GetBlockedNavigations() const {
#if BUILDFLAG(ENABLE_SUPERVISED_USERS)
SupervisedUserNavigationObserver* navigation_observer =
SupervisedUserNavigationObserver::FromWebContents(web_contents_);
// TODO(crbug.com/1061427): If the profile is supervised,
// |navigation_observer| should always be non-null. Investigate why some users
// run into null pointers here and ultimately replace the condition below with
// a DCHECK. This is a workaround to avoid reported crashes.
if (!navigation_observer)
return nullptr;
DCHECK(navigation_observer);
return &navigation_observer->blocked_navigations();
#else
......@@ -151,16 +145,8 @@ bool TabContentsSyncedTabDelegate::ShouldSync(
GetWindowId()) == nullptr)
return false;
if (ProfileIsSupervised()) {
const auto* blocked_navigations = GetBlockedNavigations();
// TODO(crbug.com/1061427): If the profile is supervised,
// |blocked_navigations| should always be non-null. Investigate why some
// users run into null pointers here and ultimately replace the condition
// below with a DCHECK. This is a workaround to avoid reported crashes.
if (blocked_navigations && !blocked_navigations->empty())
return true;
}
if (ProfileIsSupervised() && !GetBlockedNavigations()->empty())
return true;
if (IsInitialBlankNavigation())
return false; // This deliberately ignores a new pending entry.
......
......@@ -416,18 +416,13 @@ sync_pb::SessionTab LocalSessionEventHandlerImpl::GetTabSpecificsFromDelegate(
if (is_supervised) {
const std::vector<std::unique_ptr<const SerializedNavigationEntry>>*
blocked_navigations = tab_delegate.GetBlockedNavigations();
// TODO(crbug.com/1061427): If the profile is supervised,
// |blocked_navigations| should always be non-null. Investigate why some
// users run into null pointers here and ultimately replace the condition
// below with a DCHECK. This is a workaround to avoid reported crashes.
if (blocked_navigations) {
for (const auto& blocked_navigation : *blocked_navigations) {
sync_pb::TabNavigation* navigation = specifics.add_navigation();
*navigation = SessionNavigationToSyncData(*blocked_navigation);
navigation->set_blocked_state(
sync_pb::TabNavigation_BlockedState_STATE_BLOCKED);
// TODO(bauerb): Add categories
}
DCHECK(blocked_navigations);
for (const auto& entry_unique_ptr : *blocked_navigations) {
sync_pb::TabNavigation* navigation = specifics.add_navigation();
SessionNavigationToSyncData(*entry_unique_ptr).Swap(navigation);
navigation->set_blocked_state(
sync_pb::TabNavigation_BlockedState_STATE_BLOCKED);
// TODO(bauerb): Add categories
}
}
......
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