instant_service_factory.cc revision 2a99a7e74a7f215066514fe81d2bfa6639d9eddd
1// Copyright 2013 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 "chrome/browser/search/instant_service_factory.h"
6
7#include "chrome/browser/profiles/profile_dependency_manager.h"
8#include "chrome/browser/search/instant_service.h"
9
10// static
11InstantService* InstantServiceFactory::GetForProfile(Profile* profile) {
12  return static_cast<InstantService*>(
13      GetInstance()->GetServiceForProfile(profile, true));
14}
15
16// static
17InstantServiceFactory* InstantServiceFactory::GetInstance() {
18  return Singleton<InstantServiceFactory>::get();
19}
20
21InstantServiceFactory::InstantServiceFactory()
22    : ProfileKeyedServiceFactory("InstantService",
23                                 ProfileDependencyManager::GetInstance()) {
24  // No dependencies.
25}
26
27InstantServiceFactory::~InstantServiceFactory() {
28}
29
30bool InstantServiceFactory::ServiceHasOwnInstanceInIncognito() const {
31  return true;
32}
33
34ProfileKeyedService* InstantServiceFactory::BuildServiceInstanceFor(
35    Profile* profile) const {
36  return new InstantService(profile);
37}
38