Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(647)

Side by Side Diff: chrome/browser/sync/glue/synced_session_util.cc

Issue 1408643002: [Sync] Componentize synced_tab_delegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test broken by rebase Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698