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"
12 BookmarkUndoService
* BookmarkUndoServiceFactory::GetForProfile(
14 return static_cast<BookmarkUndoService
*>(
15 GetInstance()->GetServiceForBrowserContext(profile
, true));
19 BookmarkUndoService
* BookmarkUndoServiceFactory::GetForProfileIfExists(
21 return static_cast<BookmarkUndoService
*>(
22 GetInstance()->GetServiceForBrowserContext(profile
, false));
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
;