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

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

Issue 2869633003: [Sync] Hook UserEvents into sync. (Closed)
Patch Set: Rebase 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 #include "components/sync/user_events/user_event_service.h" 5 #include "components/sync/user_events/user_event_service.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/feature_list.h"
10 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
11 #include "base/rand_util.h" 12 #include "base/rand_util.h"
13 #include "components/sync/driver/sync_driver_switches.h"
12 #include "components/sync/driver/sync_service.h" 14 #include "components/sync/driver/sync_service.h"
13 #include "components/sync/model/model_type_sync_bridge.h" 15 #include "components/sync/model/model_type_sync_bridge.h"
14 #include "components/sync/protocol/sync.pb.h" 16 #include "components/sync/protocol/sync.pb.h"
15 #include "components/sync/user_events/user_event_sync_bridge.h" 17 #include "components/sync/user_events/user_event_sync_bridge.h"
16 18
17 using sync_pb::UserEventSpecifics; 19 using sync_pb::UserEventSpecifics;
18 20
19 namespace syncer { 21 namespace syncer {
20 22
21 namespace {} // namespace 23 namespace {} // namespace
(...skipping 22 matching lines...) Expand all
44 } 46 }
45 47
46 base::WeakPtr<ModelTypeSyncBridge> UserEventService::GetSyncBridge() { 48 base::WeakPtr<ModelTypeSyncBridge> UserEventService::GetSyncBridge() {
47 return bridge_->AsWeakPtr(); 49 return bridge_->AsWeakPtr();
48 } 50 }
49 51
50 bool UserEventService::CanRecordEvent(const UserEventSpecifics& specifics) { 52 bool UserEventService::CanRecordEvent(const UserEventSpecifics& specifics) {
51 // We only record events if the user is syncing history and has not enabled 53 // We only record events if the user is syncing history and has not enabled
52 // a custom passphrase. The type HISTORY_DELETE_DIRECTIVES is enabled in and 54 // a custom passphrase. The type HISTORY_DELETE_DIRECTIVES is enabled in and
53 // only in this exact scenario. 55 // only in this exact scenario.
54 return sync_service_ != nullptr && sync_service_->IsEngineInitialized() && 56 return base::FeatureList::IsEnabled(switches::kSyncUserEvents) &&
57 sync_service_ != nullptr && sync_service_->IsEngineInitialized() &&
55 sync_service_->GetPreferredDataTypes().Has(HISTORY_DELETE_DIRECTIVES); 58 sync_service_->GetPreferredDataTypes().Has(HISTORY_DELETE_DIRECTIVES);
56 } 59 }
57 60
58 } // namespace syncer 61 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/driver/sync_driver_switches.cc ('k') | components/sync/user_events/user_event_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698