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

Unified 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: to be submitted 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 side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/desktop_promotion/desktop_promotion_sync_service_factory.cc
diff --git a/ios/chrome/browser/desktop_promotion/desktop_promotion_sync_service_factory.cc b/ios/chrome/browser/desktop_promotion/desktop_promotion_sync_service_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f3acea08ee9dd2859003b8f8dc2f2f1dc7df60ec
--- /dev/null
+++ b/ios/chrome/browser/desktop_promotion/desktop_promotion_sync_service_factory.cc
@@ -0,0 +1,50 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ios/chrome/browser/desktop_promotion/desktop_promotion_sync_service_factory.h"
+
+#include "base/memory/ptr_util.h"
+
+#include "components/keyed_service/ios/browser_state_dependency_manager.h"
+#include "ios/chrome/browser/browser_state/chrome_browser_state.h"
+#include "ios/chrome/browser/desktop_promotion/desktop_promotion_sync_service.h"
+#include "ios/chrome/browser/sync/ios_chrome_profile_sync_service_factory.h"
+
+// static
+DesktopPromotionSyncService*
+DesktopPromotionSyncServiceFactory::GetForBrowserState(
+ ios::ChromeBrowserState* browser_state) {
+ return static_cast<DesktopPromotionSyncService*>(
+ GetInstance()->GetServiceForBrowserState(browser_state, true));
+}
+
+// static
+DesktopPromotionSyncServiceFactory*
+DesktopPromotionSyncServiceFactory::GetInstance() {
+ return base::Singleton<DesktopPromotionSyncServiceFactory>::get();
+}
+
+DesktopPromotionSyncServiceFactory::DesktopPromotionSyncServiceFactory()
+ : BrowserStateKeyedServiceFactory(
+ "DesktopPromotionSyncService",
+ BrowserStateDependencyManager::GetInstance()) {
+ DependsOn(IOSChromeProfileSyncServiceFactory::GetInstance());
+}
+
+DesktopPromotionSyncServiceFactory::~DesktopPromotionSyncServiceFactory() =
+ default;
+
+std::unique_ptr<KeyedService>
+DesktopPromotionSyncServiceFactory::BuildServiceInstanceFor(
+ web::BrowserState* context) const {
+ ios::ChromeBrowserState* browser_state =
+ ios::ChromeBrowserState::FromBrowserState(context);
+ return base::MakeUnique<DesktopPromotionSyncService>(
+ browser_state->GetPrefs(),
+ IOSChromeProfileSyncServiceFactory::GetForBrowserState(browser_state));
+}
+
+bool DesktopPromotionSyncServiceFactory::ServiceIsNULLWhileTesting() const {
+ return true;
+}

Powered by Google App Engine
This is Rietveld 408576698