OLD | NEW |
| (Empty) |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/sync/glue/synced_session_util.h" | |
6 | |
7 #include "chrome/common/url_constants.h" | |
8 #include "components/sessions/core/session_types.h" | |
9 #include "content/public/common/url_constants.h" | |
10 | |
11 namespace browser_sync { | |
12 | |
13 // Note: chrome:// and file:// are not considered valid urls (for syncing). | |
14 bool ShouldSyncURL(const GURL& url) { | |
15 return url.is_valid() && !url.SchemeIs(content::kChromeUIScheme) && | |
16 !url.SchemeIs(chrome::kChromeNativeScheme) && !url.SchemeIsFile(); | |
17 } | |
18 | |
19 bool ShouldSyncSessionTab(const sessions::SessionTab& tab) { | |
20 for (auto&& navigation : tab.navigations) { | |
21 if (ShouldSyncURL(navigation.virtual_url())) { | |
22 return true; | |
23 } | |
24 } | |
25 return false; | |
26 } | |
27 | |
28 bool ShouldSyncSessionWindow(const sessions::SessionWindow& window) { | |
29 for (auto* tab : window.tabs) { | |
30 if (ShouldSyncSessionTab(*tab)) { | |
31 return true; | |
32 } | |
33 } | |
34 return false; | |
35 } | |
36 | |
37 } // namespace browser_sync | |
OLD | NEW |