1// Copyright 2014 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/extensions/api/file_system/entry_watcher_service_factory.h"
6
7#include "chrome/browser/extensions/api/file_system/entry_watcher_service.h"
8#include "chrome/browser/profiles/profile.h"
9#include "components/keyed_service/content/browser_context_dependency_manager.h"
10#include "content/public/browser/browser_context.h"
11
12namespace extensions {
13
14EntryWatcherServiceFactory* EntryWatcherServiceFactory::GetInstance() {
15  return Singleton<EntryWatcherServiceFactory>::get();
16}
17
18EntryWatcherServiceFactory::EntryWatcherServiceFactory()
19    : BrowserContextKeyedServiceFactory(
20          "EntryWatcherService",
21          BrowserContextDependencyManager::GetInstance()) {
22}
23
24EntryWatcherServiceFactory::~EntryWatcherServiceFactory() {
25}
26
27KeyedService* EntryWatcherServiceFactory::BuildServiceInstanceFor(
28    content::BrowserContext* context) const {
29  return new EntryWatcherService(Profile::FromBrowserContext(context));
30}
31
32bool EntryWatcherServiceFactory::ServiceIsCreatedWithBrowserContext() const {
33  // Required to restore persistent watchers as soon as the profile is loaded.
34  return true;
35}
36
37}  // namespace extensions
38