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