OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_tab_delegate.h" | 5 #include "chrome/browser/sync/glue/synced_tab_delegate.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/browser/sync/glue/synced_session_util.h" | 8 #include "chrome/browser/sync/glue/synced_session_util.h" |
9 #include "chrome/browser/ui/sync/tab_contents_synced_tab_delegate.h" | 9 #include "chrome/browser/ui/sync/tab_contents_synced_tab_delegate.h" |
10 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 } | 29 } |
30 | 30 |
31 bool SyncedTabDelegate::ShouldSync() const { | 31 bool SyncedTabDelegate::ShouldSync() const { |
32 if (GetSyncedWindowDelegate() == nullptr) | 32 if (GetSyncedWindowDelegate() == nullptr) |
33 return false; | 33 return false; |
34 | 34 |
35 // Is there a valid NavigationEntry? | 35 // Is there a valid NavigationEntry? |
36 if (ProfileIsSupervised() && GetBlockedNavigations()->size() > 0) | 36 if (ProfileIsSupervised() && GetBlockedNavigations()->size() > 0) |
37 return true; | 37 return true; |
38 | 38 |
39 int entry_count = GetEntryCount(); | 39 if (IsInitialBlankNavigation()) |
40 if (entry_count == 0) | |
41 return false; // This deliberately ignores a new pending entry. | 40 return false; // This deliberately ignores a new pending entry. |
42 | 41 |
| 42 int entry_count = GetEntryCount(); |
43 bool found_valid_url = false; | 43 bool found_valid_url = false; |
44 for (int i = 0; i < entry_count; ++i) { | 44 for (int i = 0; i < entry_count; ++i) { |
45 const content::NavigationEntry* entry = GetEntryAtIndexMaybePending(i); | 45 const content::NavigationEntry* entry = GetEntryAtIndexMaybePending(i); |
46 if (!entry) { | 46 if (!entry) { |
47 return false; | 47 return false; |
48 } | 48 } |
49 const GURL& virtual_url = entry->GetVirtualURL(); | 49 const GURL& virtual_url = entry->GetVirtualURL(); |
50 | 50 |
51 if (ShouldSyncURL(virtual_url)) { | 51 if (ShouldSyncURL(virtual_url)) { |
52 found_valid_url = true; | 52 found_valid_url = true; |
(...skipping 12 matching lines...) Expand all Loading... |
65 } | 65 } |
66 | 66 |
67 const SyncedWindowDelegate* SyncedTabDelegate::GetSyncedWindowDelegate() const { | 67 const SyncedWindowDelegate* SyncedTabDelegate::GetSyncedWindowDelegate() const { |
68 if (!synced_window_getter_) { | 68 if (!synced_window_getter_) { |
69 NOTREACHED(); | 69 NOTREACHED(); |
70 } | 70 } |
71 return synced_window_getter_->FindById(GetWindowId()); | 71 return synced_window_getter_->FindById(GetWindowId()); |
72 } | 72 } |
73 | 73 |
74 } // namespace browser_sync | 74 } // namespace browser_sync |
OLD | NEW |