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_sync_manager.h" | 5 #include "chrome/browser/sync/sessions/sessions_sync_manager.h" |
6 | 6 |
7 #include "base/metrics/field_trial.h" | 7 #include "base/metrics/field_trial.h" |
8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
9 #include "chrome/browser/favicon/favicon_service_factory.h" | 9 #include "chrome/browser/favicon/favicon_service_factory.h" |
10 #include "chrome/browser/history/history_service_factory.h" | 10 #include "chrome/browser/history/history_service_factory.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 return s1->modified_time > s2->modified_time; | 68 return s1->modified_time > s2->modified_time; |
69 } | 69 } |
70 | 70 |
71 } // namespace | 71 } // namespace |
72 | 72 |
73 // |local_device| is owned by ProfileSyncService, its lifetime exceeds | 73 // |local_device| is owned by ProfileSyncService, its lifetime exceeds |
74 // lifetime of SessionSyncManager. | 74 // lifetime of SessionSyncManager. |
75 SessionsSyncManager::SessionsSyncManager( | 75 SessionsSyncManager::SessionsSyncManager( |
76 Profile* profile, | 76 Profile* profile, |
77 LocalDeviceInfoProvider* local_device, | 77 LocalDeviceInfoProvider* local_device, |
78 scoped_ptr<LocalSessionEventRouter> router) | 78 scoped_ptr<LocalSessionEventRouter> router, |
| 79 scoped_ptr<SyncedWindowDelegatesGetter> synced_window_getter) |
79 : favicon_cache_(FaviconServiceFactory::GetForProfile( | 80 : favicon_cache_(FaviconServiceFactory::GetForProfile( |
80 profile, | 81 profile, |
81 ServiceAccessType::EXPLICIT_ACCESS), | 82 ServiceAccessType::EXPLICIT_ACCESS), |
82 HistoryServiceFactory::GetForProfile( | 83 HistoryServiceFactory::GetForProfile( |
83 profile, | 84 profile, |
84 ServiceAccessType::EXPLICIT_ACCESS), | 85 ServiceAccessType::EXPLICIT_ACCESS), |
85 kMaxSyncFavicons), | 86 kMaxSyncFavicons), |
86 local_tab_pool_out_of_sync_(true), | 87 local_tab_pool_out_of_sync_(true), |
87 sync_prefs_(profile->GetPrefs()), | 88 sync_prefs_(profile->GetPrefs()), |
88 profile_(profile), | 89 profile_(profile), |
89 local_device_(local_device), | 90 local_device_(local_device), |
90 local_session_header_node_id_(TabNodePool::kInvalidTabNodeID), | 91 local_session_header_node_id_(TabNodePool::kInvalidTabNodeID), |
91 stale_session_threshold_days_(kDefaultStaleSessionThresholdDays), | 92 stale_session_threshold_days_(kDefaultStaleSessionThresholdDays), |
92 local_event_router_(router.Pass()), | 93 local_event_router_(router.Pass()), |
93 synced_window_getter_(new SyncedWindowDelegatesGetter()) {} | 94 synced_window_getter_(synced_window_getter.Pass()) {} |
94 | 95 |
95 LocalSessionEventRouter::~LocalSessionEventRouter() {} | 96 LocalSessionEventRouter::~LocalSessionEventRouter() {} |
96 | 97 |
97 SessionsSyncManager::~SessionsSyncManager() { | 98 SessionsSyncManager::~SessionsSyncManager() { |
98 } | 99 } |
99 | 100 |
100 // Returns the GUID-based string that should be used for | 101 // Returns the GUID-based string that should be used for |
101 // |SessionsSyncManager::current_machine_tag_|. | 102 // |SessionsSyncManager::current_machine_tag_|. |
102 static std::string BuildMachineTag(const std::string& cache_guid) { | 103 static std::string BuildMachineTag(const std::string& cache_guid) { |
103 std::string machine_tag = "session_sync"; | 104 std::string machine_tag = "session_sync"; |
(...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1111 << " with age " << session_age_in_days << ", deleting."; | 1112 << " with age " << session_age_in_days << ", deleting."; |
1112 DeleteForeignSessionInternal(session_tag, &changes); | 1113 DeleteForeignSessionInternal(session_tag, &changes); |
1113 } | 1114 } |
1114 } | 1115 } |
1115 | 1116 |
1116 if (!changes.empty()) | 1117 if (!changes.empty()) |
1117 sync_processor_->ProcessSyncChanges(FROM_HERE, changes); | 1118 sync_processor_->ProcessSyncChanges(FROM_HERE, changes); |
1118 } | 1119 } |
1119 | 1120 |
1120 }; // namespace browser_sync | 1121 }; // namespace browser_sync |
OLD | NEW |