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

Side by Side Diff: ios/chrome/browser/desktop_promotion/desktop_promotion_sync_service_factory.cc

Issue 2643723004: Add Desktop iOS promotion logging to chrome ios app. (Closed)
Patch Set: create new file for sync service & move prefs to pref_names.h Created 3 years, 11 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
(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 #include "ios/chrome/browser/desktop_promotion/desktop_promotion_sync_service_fa ctory.h"
6
7 #include "base/memory/ptr_util.h"
8
9 #include "components/keyed_service/ios/browser_state_dependency_manager.h"
10 #include "ios/chrome/browser/browser_state/chrome_browser_state.h"
11 #include "ios/chrome/browser/desktop_promotion/desktop_promotion_sync_service.h"
12 #include "ios/chrome/browser/sync/ios_chrome_profile_sync_service_factory.h"
13
14 // static
15 DesktopPromotionSyncService*
16 DesktopPromotionSyncServiceFactory::GetForBrowserState(
17 ios::ChromeBrowserState* browser_state) {
18 return static_cast<DesktopPromotionSyncService*>(
19 GetInstance()->GetServiceForBrowserState(browser_state, true));
20 }
21
22 // static
23 DesktopPromotionSyncServiceFactory*
24 DesktopPromotionSyncServiceFactory::GetInstance() {
25 return base::Singleton<DesktopPromotionSyncServiceFactory>::get();
26 }
27
28 DesktopPromotionSyncServiceFactory::DesktopPromotionSyncServiceFactory()
29 : BrowserStateKeyedServiceFactory(
30 "DesktopPromotionSyncService",
31 BrowserStateDependencyManager::GetInstance()) {
32 DependsOn(IOSChromeProfileSyncServiceFactory::GetInstance());
33 }
34
35 DesktopPromotionSyncServiceFactory::~DesktopPromotionSyncServiceFactory() =
36 default;
37
38 std::unique_ptr<KeyedService>
39 DesktopPromotionSyncServiceFactory::BuildServiceInstanceFor(
40 web::BrowserState* context) const {
41 ios::ChromeBrowserState* browser_state =
42 ios::ChromeBrowserState::FromBrowserState(context);
43 return base::MakeUnique<DesktopPromotionSyncService>(
44 browser_state->GetPrefs(),
45 IOSChromeProfileSyncServiceFactory::GetForBrowserState(browser_state));
46 }
47
48 bool DesktopPromotionSyncServiceFactory::ServiceIsNULLWhileTesting() const {
49 return true;
50 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698