Commit 65795bd7 authored by Dom Schulz's avatar Dom Schulz Committed by Commit Bot

Don't sync chrome-untrused urls.

We don't want to sync chrome-untrusted: or devtools: schemes to user
profiles. They are internal details about system apps. This cl brings
the behavior of those schemes in line with how the chrome: scheme works.

Bug: 1044864
Change-Id: Ia3549a57840d071826dda02d0f38b242404ed0a3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2493260
Commit-Queue: Dominic Schulz <dominicschulz@google.com>
Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#821322}
parent daa7f793
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "components/sync_sessions/session_sync_prefs.h" #include "components/sync_sessions/session_sync_prefs.h"
#include "components/sync_sessions/session_sync_service_impl.h" #include "components/sync_sessions/session_sync_service_impl.h"
#include "components/sync_sessions/sync_sessions_client.h" #include "components/sync_sessions/sync_sessions_client.h"
#include "content/public/common/url_utils.h"
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
#include "chrome/browser/sync/glue/synced_window_delegates_getter_android.h" #include "chrome/browser/sync/glue/synced_window_delegates_getter_android.h"
...@@ -32,11 +33,11 @@ namespace { ...@@ -32,11 +33,11 @@ namespace {
bool ShouldSyncURLImpl(const GURL& url) { bool ShouldSyncURLImpl(const GURL& url) {
if (url == chrome::kChromeUIHistoryURL) { if (url == chrome::kChromeUIHistoryURL) {
// Whitelist the chrome history page, home for "Tabs from other devices", so // Allow the chrome history page, home for "Tabs from other devices", so
// it can trigger starting up the sync engine. // it can trigger starting up the sync engine.
return true; return true;
} }
return url.is_valid() && !url.SchemeIs(content::kChromeUIScheme) && return url.is_valid() && !content::HasWebUIScheme(url) &&
!url.SchemeIs(chrome::kChromeNativeScheme) && !url.SchemeIsFile() && !url.SchemeIs(chrome::kChromeNativeScheme) && !url.SchemeIsFile() &&
!url.SchemeIs(dom_distiller::kDomDistillerScheme); !url.SchemeIs(dom_distiller::kDomDistillerScheme);
} }
......
...@@ -32,6 +32,8 @@ TEST(SessionSyncServiceFactoryTest, ShouldSyncURL) { ...@@ -32,6 +32,8 @@ TEST(SessionSyncServiceFactoryTest, ShouldSyncURL) {
EXPECT_FALSE(SessionSyncServiceFactory::ShouldSyncURLForTesting( EXPECT_FALSE(SessionSyncServiceFactory::ShouldSyncURLForTesting(
GURL("chrome-distiller://anything"))); GURL("chrome-distiller://anything")));
EXPECT_FALSE(SessionSyncServiceFactory::ShouldSyncURLForTesting(
GURL("chrome-untrusted://anything")));
EXPECT_TRUE(SessionSyncServiceFactory::ShouldSyncURLForTesting( EXPECT_TRUE(SessionSyncServiceFactory::ShouldSyncURLForTesting(
GURL(chrome::kChromeUIHistoryURL))); GURL(chrome::kChromeUIHistoryURL)));
} }
......
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