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

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

Issue 2909283003: [Sync] Split UserEventService into interface and impl, add fake impl, add unit tests. (Closed)
Patch Set: Self review. 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_impl.h
diff --git a/components/sync/user_events/user_event_service.h b/components/sync/user_events/user_event_service_impl.h
similarity index 51%
copy from components/sync/user_events/user_event_service.h
copy to components/sync/user_events/user_event_service_impl.h
index 09e2b608a2d3cb178177cc9fd3f477050386d83a..b0b1e4fa25c6dd2f33c8960f1bbcd33f17e5a174 100644
--- a/components/sync/user_events/user_event_service.h
+++ b/components/sync/user_events/user_event_service_impl.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef COMPONENTS_SYNC_USER_EVENTS_USER_EVENT_SERVICE_H_
-#define COMPONENTS_SYNC_USER_EVENTS_USER_EVENT_SERVICE_H_
+#ifndef COMPONENTS_SYNC_USER_EVENTS_USER_EVENT_SERVICE_IMPL_H_
+#define COMPONENTS_SYNC_USER_EVENTS_USER_EVENT_SERVICE_IMPL_H_
#include <memory>
#include <string>
@@ -12,6 +12,7 @@
#include "base/memory/weak_ptr.h"
#include "components/keyed_service/core/keyed_service.h"
#include "components/sync/protocol/user_event_specifics.pb.h"
+#include "components/sync/user_events/user_event_service.h"
namespace syncer {
@@ -19,31 +20,26 @@ class ModelTypeSyncBridge;
class SyncService;
class UserEventSyncBridge;
-class UserEventService : public KeyedService {
+class UserEventServiceImpl : public UserEventService {
public:
- UserEventService(SyncService* sync_service,
- std::unique_ptr<UserEventSyncBridge> bridge);
+ UserEventServiceImpl(SyncService* sync_service,
+ std::unique_ptr<UserEventSyncBridge> bridge);
+ ~UserEventServiceImpl() override;
- ~UserEventService() override;
-
- // KeyedService implementation
+ // 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);
-
- // Register that knowledge about a given field trial is important when
- // interpreting specified user event type, and should be recorded if assigned.
+ // UserEventServiceImpl implementation.
Patrick Noland 2017/05/30 23:06:41 I think you mean UserEventService implementation?
skym 2017/05/30 23:21:40 Done.
+ void RecordUserEvent(
+ std::unique_ptr<sync_pb::UserEventSpecifics> specifics) override;
+ void RecordUserEvent(const sync_pb::UserEventSpecifics& specifics) override;
void RegisterDependentFieldTrial(
const std::string& trial_name,
- sync_pb::UserEventSpecifics::EventCase event_case);
-
- base::WeakPtr<ModelTypeSyncBridge> GetSyncBridge();
+ sync_pb::UserEventSpecifics::EventCase event_case) override;
+ base::WeakPtr<ModelTypeSyncBridge> GetSyncBridge() override;
private:
+ // Whether the given event should be recorded.
Patrick Noland 2017/05/30 23:06:41 This comment is confusing when compared to the nam
skym 2017/05/30 23:21:39 You're right, I'm using can and should synonymousl
bool CanRecordEvent(const sync_pb::UserEventSpecifics& specifics);
SyncService* sync_service_;
@@ -55,9 +51,9 @@ class UserEventService : public KeyedService {
// which events came from the same session.
uint64_t session_id_;
- DISALLOW_COPY_AND_ASSIGN(UserEventService);
+ DISALLOW_COPY_AND_ASSIGN(UserEventServiceImpl);
};
} // namespace syncer
-#endif // COMPONENTS_SYNC_USER_EVENTS_USER_EVENT_SERVICE_H_
+#endif // COMPONENTS_SYNC_USER_EVENTS_USER_EVENT_SERVICE_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698