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

Unified Diff: components/sync/user_events/user_event_service.h

Issue 2909283003: [Sync] Split UserEventService into interface and impl, add fake impl, add unit tests. (Closed)
Patch Set: Added a NoOp service to handle OffTheRecord. 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 side-by-side diff with in-line comments
Download patch
Index: components/sync/user_events/user_event_service.h
diff --git a/components/sync/user_events/user_event_service.h b/components/sync/user_events/user_event_service.h
index 09e2b608a2d3cb178177cc9fd3f477050386d83a..0e7841de7fd619b739a34d8d1b4fe203aab62bd5 100644
--- a/components/sync/user_events/user_event_service.h
+++ b/components/sync/user_events/user_event_service.h
@@ -16,45 +16,30 @@
namespace syncer {
class ModelTypeSyncBridge;
-class SyncService;
-class UserEventSyncBridge;
class UserEventService : public KeyedService {
public:
- UserEventService(SyncService* sync_service,
- std::unique_ptr<UserEventSyncBridge> bridge);
-
+ UserEventService();
~UserEventService() override;
- // KeyedService implementation
- void Shutdown() override;
-
// Records a given event to be reported. Relevant settings will be checked to
// verify user events should be emitted and this will no-op if the the
// requisite permissions are not present.
- void RecordUserEvent(std::unique_ptr<sync_pb::UserEventSpecifics> specifics);
- void RecordUserEvent(const sync_pb::UserEventSpecifics& specifics);
+ virtual void RecordUserEvent(
+ std::unique_ptr<sync_pb::UserEventSpecifics> specifics) = 0;
+ virtual void RecordUserEvent(
+ const sync_pb::UserEventSpecifics& specifics) = 0;
// Register that knowledge about a given field trial is important when
// interpreting specified user event type, and should be recorded if assigned.
- void RegisterDependentFieldTrial(
+ virtual void RegisterDependentFieldTrial(
const std::string& trial_name,
- sync_pb::UserEventSpecifics::EventCase event_case);
+ sync_pb::UserEventSpecifics::EventCase event_case) = 0;
- base::WeakPtr<ModelTypeSyncBridge> GetSyncBridge();
+ // Returns the underlying Sync integration point.
+ virtual base::WeakPtr<ModelTypeSyncBridge> GetSyncBridge() = 0;
private:
- bool CanRecordEvent(const sync_pb::UserEventSpecifics& specifics);
-
- SyncService* sync_service_;
-
- std::unique_ptr<UserEventSyncBridge> bridge_;
-
- // Holds onto a random number for the duration of this execution of chrome. On
- // restart it will be regenerated. This can be attached to events to know
- // which events came from the same session.
- uint64_t session_id_;
-
DISALLOW_COPY_AND_ASSIGN(UserEventService);
};
« no previous file with comments | « components/sync/user_events/no_op_user_event_service.cc ('k') | components/sync/user_events/user_event_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698