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

Side by Side Diff: components/sync/user_events/user_event_service.h

Issue 2880683002: Adding RegisterDependantFieldTrial interface method. (Closed)
Patch Set: Adding proto_visitors.h change. Created 3 years, 7 months 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 2017 The Chromium Authors. All rights reserved. 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 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_USER_EVENTS_USER_EVENT_SERVICE_H_ 5 #ifndef COMPONENTS_SYNC_USER_EVENTS_USER_EVENT_SERVICE_H_
6 #define COMPONENTS_SYNC_USER_EVENTS_USER_EVENT_SERVICE_H_ 6 #define COMPONENTS_SYNC_USER_EVENTS_USER_EVENT_SERVICE_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string>
9 10
10 #include "base/macros.h" 11 #include "base/macros.h"
11 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
12 #include "components/keyed_service/core/keyed_service.h" 13 #include "components/keyed_service/core/keyed_service.h"
13 14 #include "components/sync/protocol/user_event_specifics.pb.h"
14 namespace sync_pb {
15 class UserEventSpecifics;
16 } // namespace sync_pb
17 15
18 namespace syncer { 16 namespace syncer {
19 17
20 class ModelTypeSyncBridge; 18 class ModelTypeSyncBridge;
21 class SyncService; 19 class SyncService;
22 class UserEventSyncBridge; 20 class UserEventSyncBridge;
23 21
24 class UserEventService : public KeyedService { 22 class UserEventService : public KeyedService {
25 public: 23 public:
26 UserEventService(SyncService* sync_service, 24 UserEventService(SyncService* sync_service,
27 std::unique_ptr<UserEventSyncBridge> bridge); 25 std::unique_ptr<UserEventSyncBridge> bridge);
28 26
29 ~UserEventService() override; 27 ~UserEventService() override;
30 28
31 // KeyedService implementation 29 // KeyedService implementation
32 void Shutdown() override; 30 void Shutdown() override;
33 31
34 // Records a given event to be reported. Relevant settings will be checked to 32 // 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 33 // verify user events should be emitted and this will no-op if the the
36 // requisite permissions are not present. 34 // requisite permissions are not present.
37 void RecordUserEvent(std::unique_ptr<sync_pb::UserEventSpecifics> specifics); 35 void RecordUserEvent(std::unique_ptr<sync_pb::UserEventSpecifics> specifics);
38 void RecordUserEvent(const sync_pb::UserEventSpecifics& specifics); 36 void RecordUserEvent(const sync_pb::UserEventSpecifics& specifics);
39 37
38 // Register that knowledge about a given field trail is important when
Patrick Noland 2017/05/12 18:12:30 [nit] trial
skym 2017/05/12 21:05:38 Done.
39 // interpreting specified user event type, and should be recorded if assigned.
40 void RegisterDependantFieldTrial(
Patrick Noland 2017/05/12 18:12:30 [nit] Dependent
skym 2017/05/12 21:05:38 Done.
41 const std::string& trial_name,
42 sync_pb::UserEventSpecifics::EventCase event_case);
43
40 base::WeakPtr<ModelTypeSyncBridge> GetSyncBridge(); 44 base::WeakPtr<ModelTypeSyncBridge> GetSyncBridge();
41 45
42 private: 46 private:
43 bool CanRecordEvent(const sync_pb::UserEventSpecifics& specifics); 47 bool CanRecordEvent(const sync_pb::UserEventSpecifics& specifics);
44 48
45 SyncService* sync_service_; 49 SyncService* sync_service_;
46 50
47 std::unique_ptr<UserEventSyncBridge> bridge_; 51 std::unique_ptr<UserEventSyncBridge> bridge_;
48 52
49 // Holds onto a random number for the duration of this execution of chrome. On 53 // 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 54 // restart it will be regenerated. This can be attached to events to know
51 // which events came from the same session. 55 // which events came from the same session.
52 uint64_t session_id_; 56 uint64_t session_id_;
53 57
54 DISALLOW_COPY_AND_ASSIGN(UserEventService); 58 DISALLOW_COPY_AND_ASSIGN(UserEventService);
55 }; 59 };
56 60
57 } // namespace syncer 61 } // namespace syncer
58 62
59 #endif // COMPONENTS_SYNC_USER_EVENTS_USER_EVENT_SERVICE_H_ 63 #endif // COMPONENTS_SYNC_USER_EVENTS_USER_EVENT_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698