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

Unified Diff: chrome/browser/search/google_search_provider_service_factory.cc

Issue 2805133004: Local NTP: Deploy strict-dynamic CSP (Closed)
Patch Set: fix Created 3 years, 8 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: chrome/browser/search/google_search_provider_service_factory.cc
diff --git a/chrome/browser/search/google_search_provider_service_factory.cc b/chrome/browser/search/google_search_provider_service_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..980d8156d75ed933efc445a26e0612be9dbcfc8e
--- /dev/null
+++ b/chrome/browser/search/google_search_provider_service_factory.cc
@@ -0,0 +1,41 @@
+// 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 "chrome/browser/search/google_search_provider_service_factory.h"
+
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/search/google_search_provider_service.h"
+#include "chrome/browser/search_engines/template_url_service_factory.h"
+#include "components/keyed_service/content/browser_context_dependency_manager.h"
+#include "content/public/browser/browser_context.h"
+
+// static
+GoogleSearchProviderService* GoogleSearchProviderServiceFactory::GetForProfile(
+ Profile* profile) {
+ return static_cast<GoogleSearchProviderService*>(
+ GetInstance()->GetServiceForBrowserContext(profile, true));
+}
+
+// static
+GoogleSearchProviderServiceFactory*
+GoogleSearchProviderServiceFactory::GetInstance() {
+ return base::Singleton<GoogleSearchProviderServiceFactory>::get();
+}
+
+GoogleSearchProviderServiceFactory::GoogleSearchProviderServiceFactory()
+ : BrowserContextKeyedServiceFactory(
+ "GoogleSearchProviderService",
+ BrowserContextDependencyManager::GetInstance()) {
+ DependsOn(TemplateURLServiceFactory::GetInstance());
+}
+
+GoogleSearchProviderServiceFactory::~GoogleSearchProviderServiceFactory() =
+ default;
+
+KeyedService* GoogleSearchProviderServiceFactory::BuildServiceInstanceFor(
+ content::BrowserContext* context) const {
+ Profile* profile = Profile::FromBrowserContext(context);
+ return new GoogleSearchProviderService(
+ TemplateURLServiceFactory::GetForProfile(profile));
+}

Powered by Google App Engine
This is Rietveld 408576698