summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/api/commands/command_service_factory.cc
blob: 91651d95c8144575d579950c6b315006c426e976 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright (c) 2012 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/extensions/api/commands/command_service_factory.h"

#include "chrome/browser/extensions/api/commands/command_service.h"
#include "chrome/browser/extensions/extension_system_factory.h"
#include "chrome/browser/profiles/profile_dependency_manager.h"

namespace extensions {

// static
CommandService* CommandServiceFactory::GetForProfile(
    Profile* profile) {
  return static_cast<CommandService*>(
      GetInstance()->GetServiceForProfile(profile, true));
}

// static
CommandServiceFactory* CommandServiceFactory::GetInstance() {
  return Singleton<CommandServiceFactory>::get();
}

bool CommandServiceFactory::ServiceIsCreatedWithProfile() {
  return true;
}

CommandServiceFactory::CommandServiceFactory()
    : ProfileKeyedServiceFactory("CommandService",
                                 ProfileDependencyManager::GetInstance()) {
  DependsOn(ExtensionSystemFactory::GetInstance());
}

CommandServiceFactory::~CommandServiceFactory() {
}

ProfileKeyedService* CommandServiceFactory::BuildServiceInstanceFor(
    Profile* profile) const {
  return new CommandService(profile);
}

bool CommandServiceFactory::ServiceRedirectedInIncognito() {
  return true;
}

}  // namespace extensions