OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef COMPONENTS_SYNC_USER_EVENTS_GLOBAL_ID_MAPPER_H_ |
| 6 #define COMPONENTS_SYNC_USER_EVENTS_GLOBAL_ID_MAPPER_H_ |
| 7 |
| 8 #include <stdint.h> |
| 9 |
| 10 #include "base/callback.h" |
| 11 |
| 12 namespace syncer { |
| 13 |
| 14 using GlobalIdChange = |
| 15 base::RepeatingCallback<void(int64_t old_global_id, int64_t new_global_id)>; |
| 16 |
| 17 // UserEventSpecifics references SESSIONS data through their |navigation_id| |
| 18 // which will match values seen in TabNavigation's |global_id|. This field is |
| 19 // really just the timestamp from the NavigationEntry, which can change when a |
| 20 // page is reloaded. This will cause the SESSIONS side to override the old data. |
| 21 // The impact to USER_EVENTS depends on if the previous timestamp made it to the |
| 22 // server as part of SESSIONS data or not. If it did not, then USER_EVENTS must |
| 23 // be updated. But knowing the answer that question is currently very tricky |
| 24 // with Sync's current architecture, so instead we always update for uncommitted |
| 25 // USER_EVENTS. The purpose of the GlobalIdMapper is the track changes in the |
| 26 // SESSIONS' |global_id| field and feed this information the USER_EVENTS side. |
| 27 class GlobalIdMapper { |
| 28 public: |
| 29 // Register for information about changing |
| 30 virtual void AddGlobalIdChangeObserver(GlobalIdChange callback) = 0; |
| 31 |
| 32 // Given a |global_id|, returns what the latest global_id is for the given |
| 33 // navigation, to the best of our ability. If we do not have such a mapping, |
| 34 // which is quite possible, the input |global_id| is returned. |
| 35 virtual int64_t GetLatestGlobalId(int64_t global_id) = 0; |
| 36 }; |
| 37 |
| 38 } // namespace syncer |
| 39 |
| 40 #endif // COMPONENTS_SYNC_USER_EVENTS_GLOBAL_ID_MAPPER_H_ |
OLD | NEW |