OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/sessions/sessions_util.h" | 5 #include "chrome/browser/sync/sessions/sessions_util.h" |
6 | 6 |
7 #include "chrome/browser/sync/glue/synced_tab_delegate.h" | 7 #include "chrome/browser/sync/glue/synced_tab_delegate.h" |
8 #include "chrome/browser/sync/glue/synced_window_delegate.h" | 8 #include "chrome/browser/sync/glue/synced_window_delegate.h" |
9 #include "chrome/common/url_constants.h" | 9 #include "chrome/common/url_constants.h" |
10 #include "content/public/browser/navigation_entry.h" | 10 #include "content/public/browser/navigation_entry.h" |
11 #include "url/gurl.h" | 11 #include "url/gurl.h" |
12 | 12 |
13 namespace browser_sync { | 13 namespace browser_sync { |
14 | 14 |
15 namespace sessions_util { | 15 namespace sessions_util { |
16 | 16 |
17 bool ShouldSyncTab(const SyncedTabDelegate& tab) { | 17 bool ShouldSyncTab(const SyncedTabDelegate& tab) { |
18 if (SyncedWindowDelegate::FindSyncedWindowDelegateWithId( | 18 if (SyncedWindowDelegate::FindSyncedWindowDelegateWithId( |
19 tab.GetWindowId()) == NULL) { | 19 tab.GetWindowId()) == NULL) { |
20 return false; | 20 return false; |
21 } | 21 } |
22 | 22 |
23 // Does the tab have a valid NavigationEntry? | 23 // Does the tab have a valid NavigationEntry? |
24 if (tab.ProfileIsManaged() && tab.GetBlockedNavigations()->size() > 0) | 24 if (tab.ProfileIsSupervised() && tab.GetBlockedNavigations()->size() > 0) |
25 return true; | 25 return true; |
26 | 26 |
27 int entry_count = tab.GetEntryCount(); | 27 int entry_count = tab.GetEntryCount(); |
28 if (entry_count == 0) | 28 if (entry_count == 0) |
29 return false; // This deliberately ignores a new pending entry. | 29 return false; // This deliberately ignores a new pending entry. |
30 | 30 |
31 int pending_index = tab.GetPendingEntryIndex(); | 31 int pending_index = tab.GetPendingEntryIndex(); |
32 bool found_valid_url = false; | 32 bool found_valid_url = false; |
33 for (int i = 0; i < entry_count; ++i) { | 33 for (int i = 0; i < entry_count; ++i) { |
34 const content::NavigationEntry* entry = (i == pending_index) ? | 34 const content::NavigationEntry* entry = (i == pending_index) ? |
(...skipping 13 matching lines...) Expand all Loading... |
48 | 48 |
49 bool ShouldSyncWindow(const SyncedWindowDelegate* window) { | 49 bool ShouldSyncWindow(const SyncedWindowDelegate* window) { |
50 if (window->IsApp()) | 50 if (window->IsApp()) |
51 return false; | 51 return false; |
52 return window->IsTypeTabbed() || window->IsTypePopup(); | 52 return window->IsTypeTabbed() || window->IsTypePopup(); |
53 } | 53 } |
54 | 54 |
55 } // namespace sessions_util | 55 } // namespace sessions_util |
56 | 56 |
57 } // namespace browser_sync | 57 } // namespace browser_sync |
OLD | NEW |