OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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.h" | 5 #include "chrome/browser/sync/glue/synced_session.h" |
6 | 6 |
7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "chrome/common/url_constants.h" | 8 #include "chrome/common/url_constants.h" |
9 #include "content/public/browser/navigation_entry.h" | 9 #include "content/public/browser/navigation_entry.h" |
10 #include "content/public/common/url_constants.h" | 10 #include "content/public/common/url_constants.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 // Note: if you modify this, make sure you modify | 58 // Note: if you modify this, make sure you modify |
59 // SessionModelAssociator::ShouldSyncTab to ensure the logic matches. | 59 // SessionModelAssociator::ShouldSyncTab to ensure the logic matches. |
60 bool ShouldSyncSessionTab(const SessionTab& tab) { | 60 bool ShouldSyncSessionTab(const SessionTab& tab) { |
61 if (tab.navigations.empty()) | 61 if (tab.navigations.empty()) |
62 return false; | 62 return false; |
63 bool found_valid_url = false; | 63 bool found_valid_url = false; |
64 for (size_t i = 0; i < tab.navigations.size(); ++i) { | 64 for (size_t i = 0; i < tab.navigations.size(); ++i) { |
65 const GURL& virtual_url = tab.navigations.at(i).virtual_url(); | 65 const GURL& virtual_url = tab.navigations.at(i).virtual_url(); |
66 if (virtual_url.is_valid() && | 66 if (virtual_url.is_valid() && |
67 !virtual_url.SchemeIs(chrome::kChromeUIScheme) && | 67 !virtual_url.SchemeIs(content::kChromeUIScheme) && |
68 !virtual_url.SchemeIs(chrome::kChromeNativeScheme) && | 68 !virtual_url.SchemeIs(chrome::kChromeNativeScheme) && |
69 !virtual_url.SchemeIsFile()) { | 69 !virtual_url.SchemeIsFile()) { |
70 found_valid_url = true; | 70 found_valid_url = true; |
71 break; | 71 break; |
72 } | 72 } |
73 } | 73 } |
74 return found_valid_url; | 74 return found_valid_url; |
75 } | 75 } |
76 | 76 |
77 bool SessionWindowHasNoTabsToSync(const SessionWindow& window) { | 77 bool SessionWindowHasNoTabsToSync(const SessionWindow& window) { |
78 int num_populated = 0; | 78 int num_populated = 0; |
79 for (std::vector<SessionTab*>::const_iterator i = window.tabs.begin(); | 79 for (std::vector<SessionTab*>::const_iterator i = window.tabs.begin(); |
80 i != window.tabs.end(); ++i) { | 80 i != window.tabs.end(); ++i) { |
81 const SessionTab* tab = *i; | 81 const SessionTab* tab = *i; |
82 if (ShouldSyncSessionTab(*tab)) | 82 if (ShouldSyncSessionTab(*tab)) |
83 num_populated++; | 83 num_populated++; |
84 } | 84 } |
85 return (num_populated == 0); | 85 return (num_populated == 0); |
86 } | 86 } |
87 | 87 |
88 } // namespace browser_sync | 88 } // namespace browser_sync |
OLD | NEW |