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

Unified Diff: ios/chrome/browser/ntp_snippets/ios_chrome_ntp_snippets_service_factory.cc

Issue 1438043008: Creating the NTP snippet service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase fix: Don't trust git. Created 5 years, 1 month 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/ntp_snippets/ios_chrome_ntp_snippets_service_factory.cc
diff --git a/ios/chrome/browser/ntp_snippets/ios_chrome_ntp_snippets_service_factory.cc b/ios/chrome/browser/ntp_snippets/ios_chrome_ntp_snippets_service_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..15cd8d258fe68705d25763a75ba0cf4f583ca772
--- /dev/null
+++ b/ios/chrome/browser/ntp_snippets/ios_chrome_ntp_snippets_service_factory.cc
@@ -0,0 +1,42 @@
+// Copyright 2015 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/ntp_snippets/ios_chrome_ntp_snippets_service_factory.h"
+
+#include "base/logging.h"
+#include "base/memory/singleton.h"
+#include "components/keyed_service/ios/browser_state_dependency_manager.h"
+#include "components/ntp_snippets/ntp_snippets_service.h"
+#include "ios/chrome/browser/application_context.h"
+#include "ios/public/provider/chrome/browser/browser_state/chrome_browser_state.h"
+
+// static
+IOSChromeNTPSnippetsServiceFactory*
+IOSChromeNTPSnippetsServiceFactory::GetInstance() {
+ return base::Singleton<IOSChromeNTPSnippetsServiceFactory>::get();
+}
+
+// static
+ntp_snippets::NTPSnippetsService*
+IOSChromeNTPSnippetsServiceFactory::GetForBrowserState(
+ ios::ChromeBrowserState* browser_state) {
+ DCHECK(!browser_state->IsOffTheRecord());
+ return static_cast<ntp_snippets::NTPSnippetsService*>(
+ GetInstance()->GetServiceForBrowserState(browser_state, true));
+}
+
+IOSChromeNTPSnippetsServiceFactory::IOSChromeNTPSnippetsServiceFactory()
+ : BrowserStateKeyedServiceFactory(
+ "NTPSnippetsService",
+ BrowserStateDependencyManager::GetInstance()) {}
+
+IOSChromeNTPSnippetsServiceFactory::~IOSChromeNTPSnippetsServiceFactory() {}
+
+scoped_ptr<KeyedService>
+IOSChromeNTPSnippetsServiceFactory::BuildServiceInstanceFor(
+ web::BrowserState* browser_state) const {
+ DCHECK(!browser_state->IsOffTheRecord());
+ return make_scoped_ptr(new ntp_snippets::NTPSnippetsService(
+ GetApplicationContext()->GetApplicationLocale()));
+}
« no previous file with comments | « ios/chrome/browser/ntp_snippets/ios_chrome_ntp_snippets_service_factory.h ('k') | ios/chrome/ios_chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698