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

Side by Side Diff: components/sync_sessions/sessions_sync_manager.h

Issue 2546163003: [Sync] Convert SyncSessions to NonUIDataTypeController and remove UIDataTypeController (Closed)
Patch Set: Fix SyncSessionsMetricsTest Created 4 years 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
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 #ifndef COMPONENTS_SYNC_SESSIONS_SESSIONS_SYNC_MANAGER_H_ 5 #ifndef COMPONENTS_SYNC_SESSIONS_SESSIONS_SYNC_MANAGER_H_
6 #define COMPONENTS_SYNC_SESSIONS_SESSIONS_SYNC_MANAGER_H_ 6 #define COMPONENTS_SYNC_SESSIONS_SESSIONS_SYNC_MANAGER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 MergeLocalSessionExistingTabs); 173 MergeLocalSessionExistingTabs);
174 FRIEND_TEST_ALL_PREFIXES(SessionsSyncManagerTest, 174 FRIEND_TEST_ALL_PREFIXES(SessionsSyncManagerTest,
175 CheckPrerenderedWebContentsSwap); 175 CheckPrerenderedWebContentsSwap);
176 FRIEND_TEST_ALL_PREFIXES(SessionsSyncManagerTest, 176 FRIEND_TEST_ALL_PREFIXES(SessionsSyncManagerTest,
177 AssociateWindowsDontReloadTabs); 177 AssociateWindowsDontReloadTabs);
178 FRIEND_TEST_ALL_PREFIXES(SessionsSyncManagerTest, SwappedOutOnRestore); 178 FRIEND_TEST_ALL_PREFIXES(SessionsSyncManagerTest, SwappedOutOnRestore);
179 FRIEND_TEST_ALL_PREFIXES(SessionsSyncManagerTest, 179 FRIEND_TEST_ALL_PREFIXES(SessionsSyncManagerTest,
180 ProcessRemoteDeleteOfLocalSession); 180 ProcessRemoteDeleteOfLocalSession);
181 FRIEND_TEST_ALL_PREFIXES(SessionsSyncManagerTest, SetVariationIds); 181 FRIEND_TEST_ALL_PREFIXES(SessionsSyncManagerTest, SetVariationIds);
182 182
183 void InitializeCurrentMachineTag(); 183 void InitializeCurrentMachineTag(const std::string& cache_guid);
184 184
185 // Load and add window or tab data for a foreign session to our internal 185 // Load and add window or tab data for a foreign session to our internal
186 // tracking. 186 // tracking.
187 void UpdateTrackerWithForeignSession( 187 void UpdateTrackerWithForeignSession(
188 const sync_pb::SessionSpecifics& specifics, 188 const sync_pb::SessionSpecifics& specifics,
189 const base::Time& modification_time); 189 const base::Time& modification_time);
190 190
191 // Returns true if |sync_data| contained a header node for the current 191 // Returns true if |sync_data| contained a header node for the current
192 // machine, false otherwise. |restored_tabs| is a filtered tab-only 192 // machine, false otherwise. |restored_tabs| is a filtered tab-only
193 // subset of |sync_data| returned by this function for convenience. 193 // subset of |sync_data| returned by this function for convenience.
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 // way because they don't yet have a WebContents. 292 // way because they don't yet have a WebContents.
293 // TODO(tim): Bug 98892. We should be able to test this for this on android 293 // TODO(tim): Bug 98892. We should be able to test this for this on android
294 // even though we didn't have tests for old API-based sessions sync. 294 // even though we didn't have tests for old API-based sessions sync.
295 void AssociateRestoredPlaceholderTab( 295 void AssociateRestoredPlaceholderTab(
296 const SyncedTabDelegate& tab_delegate, 296 const SyncedTabDelegate& tab_delegate,
297 SessionID::id_type new_tab_id, 297 SessionID::id_type new_tab_id,
298 SessionID::id_type new_window_id, 298 SessionID::id_type new_window_id,
299 const syncer::SyncDataList& restored_tabs, 299 const syncer::SyncDataList& restored_tabs,
300 syncer::SyncChangeList* change_output); 300 syncer::SyncChangeList* change_output);
301 301
302 // Stops and re-starts syncing to rebuild association mappings. 302 // Stops and re-starts syncing to rebuild association mappings. Returns true
303 // when re-starting succeeds.
303 // See |local_tab_pool_out_of_sync_|. 304 // See |local_tab_pool_out_of_sync_|.
304 void RebuildAssociations(); 305 bool RebuildAssociations();
305 306
306 // Validates the content of a SessionHeader protobuf. 307 // Validates the content of a SessionHeader protobuf.
307 // Returns false if validation fails. 308 // Returns false if validation fails.
308 static bool IsValidSessionHeader(const sync_pb::SessionHeader& header); 309 static bool IsValidSessionHeader(const sync_pb::SessionHeader& header);
309 310
310 // Calculates the tag hash from a specifics object. Calculating the hash is 311 // Calculates the tag hash from a specifics object. Calculating the hash is
311 // something we typically want to avoid doing in the model type like this. 312 // something we typically want to avoid doing in the model type like this.
312 // However, the only place that understands how to generate a tag from the 313 // However, the only place that understands how to generate a tag from the
313 // specifics is the model type, ie us. We need to generate the tag because it 314 // specifics is the model type, ie us. We need to generate the tag because it
314 // is not passed over the wire for remote data. The use case this function was 315 // is not passed over the wire for remote data. The use case this function was
(...skipping 29 matching lines...) Expand all
344 345
345 std::unique_ptr<syncer::SyncErrorFactory> error_handler_; 346 std::unique_ptr<syncer::SyncErrorFactory> error_handler_;
346 std::unique_ptr<syncer::SyncChangeProcessor> sync_processor_; 347 std::unique_ptr<syncer::SyncChangeProcessor> sync_processor_;
347 348
348 // Local device info provider, owned by ProfileSyncService. 349 // Local device info provider, owned by ProfileSyncService.
349 const syncer::LocalDeviceInfoProvider* const local_device_; 350 const syncer::LocalDeviceInfoProvider* const local_device_;
350 351
351 // Unique client tag. 352 // Unique client tag.
352 std::string current_machine_tag_; 353 std::string current_machine_tag_;
353 354
354 // User-visible machine name. 355 // User-visible machine name and device type to populate header.
355 std::string current_session_name_; 356 std::string current_session_name_;
357 sync_pb::SyncEnums::DeviceType current_device_type_;
356 358
357 // SyncID for the sync node containing all the window information for this 359 // SyncID for the sync node containing all the window information for this
358 // client. 360 // client.
359 int local_session_header_node_id_; 361 int local_session_header_node_id_;
360 362
361 // Number of days without activity after which we consider a session to be 363 // Number of days without activity after which we consider a session to be
362 // stale and a candidate for garbage collection. 364 // stale and a candidate for garbage collection.
363 int stale_session_threshold_days_; 365 int stale_session_threshold_days_;
364 366
365 std::unique_ptr<LocalSessionEventRouter> local_event_router_; 367 std::unique_ptr<LocalSessionEventRouter> local_event_router_;
366 368
367 // Owns revisiting instrumentation logic for page visit events. 369 // Owns revisiting instrumentation logic for page visit events.
368 PageRevisitBroadcaster page_revisit_broadcaster_; 370 PageRevisitBroadcaster page_revisit_broadcaster_;
369 371
370 std::unique_ptr<sync_sessions::LostNavigationsRecorder> 372 std::unique_ptr<sync_sessions::LostNavigationsRecorder>
371 lost_navigations_recorder_; 373 lost_navigations_recorder_;
372 374
373 // Callback to inform interested observer that new sessions data has arrived. 375 // Callback to inform interested observer that new sessions data has arrived.
374 base::Closure sessions_updated_callback_; 376 base::Closure sessions_updated_callback_;
375 377
376 // Callback to inform sync that a sync data refresh is requested. 378 // Callback to inform sync that a sync data refresh is requested.
377 base::Closure datatype_refresh_callback_; 379 base::Closure datatype_refresh_callback_;
378 380
379 DISALLOW_COPY_AND_ASSIGN(SessionsSyncManager); 381 DISALLOW_COPY_AND_ASSIGN(SessionsSyncManager);
380 }; 382 };
381 383
382 } // namespace sync_sessions 384 } // namespace sync_sessions
383 385
384 #endif // COMPONENTS_SYNC_SESSIONS_SESSIONS_SYNC_MANAGER_H_ 386 #endif // COMPONENTS_SYNC_SESSIONS_SESSIONS_SYNC_MANAGER_H_
OLDNEW
« no previous file with comments | « components/sync_sessions/session_data_type_controller.cc ('k') | components/sync_sessions/sessions_sync_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698