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/undo/bookmark_undo_service_factory.h"
6
7#include "chrome/browser/bookmarks/bookmark_model_factory.h"
8#include "chrome/browser/profiles/profile.h"
9#include "chrome/browser/undo/bookmark_undo_service.h"
10#include "components/keyed_service/content/browser_context_dependency_manager.h"
11
12// static
13BookmarkUndoService* BookmarkUndoServiceFactory::GetForProfile(
14    Profile* profile) {
15  return static_cast<BookmarkUndoService*>(
16      GetInstance()->GetServiceForBrowserContext(profile, true));
17}
18
19// static
20BookmarkUndoServiceFactory* BookmarkUndoServiceFactory::GetInstance() {
21  return Singleton<BookmarkUndoServiceFactory>::get();
22}
23
24BookmarkUndoServiceFactory::BookmarkUndoServiceFactory()
25    : BrowserContextKeyedServiceFactory(
26        "BookmarkUndoService",
27        BrowserContextDependencyManager::GetInstance()) {
28  DependsOn(BookmarkModelFactory::GetInstance());
29}
30
31BookmarkUndoServiceFactory::~BookmarkUndoServiceFactory() {
32}
33
34KeyedService* BookmarkUndoServiceFactory::BuildServiceInstanceFor(
35    content::BrowserContext* context) const {
36  Profile* profile = static_cast<Profile*>(context);
37  return new BookmarkUndoService(profile);
38}
39