Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / undo / bookmark_undo_service_factory.cc
blobdcece8a7e7b49113759178350cb4c274db251109
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.
5 #include "chrome/browser/undo/bookmark_undo_service_factory.h"
7 #include "chrome/browser/profiles/profile.h"
8 #include "components/keyed_service/content/browser_context_dependency_manager.h"
9 #include "components/undo/bookmark_undo_service.h"
11 // static
12 BookmarkUndoService* BookmarkUndoServiceFactory::GetForProfile(
13 Profile* profile) {
14 return static_cast<BookmarkUndoService*>(
15 GetInstance()->GetServiceForBrowserContext(profile, true));
18 // static
19 BookmarkUndoService* BookmarkUndoServiceFactory::GetForProfileIfExists(
20 Profile* profile) {
21 return static_cast<BookmarkUndoService*>(
22 GetInstance()->GetServiceForBrowserContext(profile, false));
25 // static
26 BookmarkUndoServiceFactory* BookmarkUndoServiceFactory::GetInstance() {
27 return base::Singleton<BookmarkUndoServiceFactory>::get();
30 BookmarkUndoServiceFactory::BookmarkUndoServiceFactory()
31 : BrowserContextKeyedServiceFactory(
32 "BookmarkUndoService",
33 BrowserContextDependencyManager::GetInstance()) {
36 BookmarkUndoServiceFactory::~BookmarkUndoServiceFactory() {
39 KeyedService* BookmarkUndoServiceFactory::BuildServiceInstanceFor(
40 content::BrowserContext* context) const {
41 return new BookmarkUndoService;