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_USER_EVENT_SERVICE_H_ | |
6 #define COMPONENTS_SYNC_USER_EVENTS_USER_EVENT_SERVICE_H_ | |
7 | |
8 #include <memory> | |
9 | |
10 #include "base/macros.h" | |
11 #include "base/memory/weak_ptr.h" | |
12 #include "components/keyed_service/core/keyed_service.h" | |
13 | |
14 namespace sync_pb { | |
15 class UserEventSpecifics; | |
16 } // namespace sync_pb | |
17 | |
18 namespace syncer { | |
19 | |
20 class ModelTypeSyncBridge; | |
21 class SyncService; | |
22 class UserEventSyncBridge; | |
23 | |
24 class UserEventService : public KeyedService { | |
25 public: | |
26 UserEventService(SyncService* sync_service, | |
27 std::unique_ptr<UserEventSyncBridge> bridge); | |
28 | |
29 ~UserEventService() override; | |
30 | |
31 // KeyedService implementation | |
32 void Shutdown() override; | |
33 | |
34 // Records a given event to be reported. Relevant settings will be checked to | |
35 // verify user events should be emitted and this will no-op if the the | |
36 // requisite permissions are not present. | |
37 void RecordUserEvent(std::unique_ptr<sync_pb::UserEventSpecifics> specifics); | |
Patrick Noland
2017/05/08 22:42:37
Is there no way to tell(as a consumer of this serv
skym
2017/05/08 23:35:27
Well, we could certainly add it. Would be easy to
Patrick Noland
2017/05/08 23:41:29
It would be easier to blindly write, and it's prob
| |
38 void RecordUserEvent(const sync_pb::UserEventSpecifics& specifics); | |
39 | |
40 base::WeakPtr<ModelTypeSyncBridge> GetSyncBridge(); | |
41 | |
42 private: | |
43 bool CanRecordEvent(const sync_pb::UserEventSpecifics& specifics); | |
44 | |
45 SyncService* sync_service_; | |
46 | |
47 std::unique_ptr<UserEventSyncBridge> bridge_; | |
48 | |
49 // Holds onto a random number for the duration of this execution of chrome. On | |
50 // restart it will be regenerated. This can be attached to events to know | |
51 // which events came from the same session. | |
52 uint64_t session_id_; | |
53 | |
54 DISALLOW_COPY_AND_ASSIGN(UserEventService); | |
55 }; | |
56 | |
57 } // namespace syncer | |
58 | |
59 #endif // COMPONENTS_SYNC_USER_EVENTS_USER_EVENT_SERVICE_H_ | |
OLD | NEW |