OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/undo/bookmark_undo_service_factory.h" | 5 #include "chrome/browser/undo/bookmark_undo_service_factory.h" |
6 | 6 |
7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
8 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 8 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
9 #include "components/undo/bookmark_undo_service.h" | 9 #include "components/undo/bookmark_undo_service.h" |
10 | 10 |
11 // static | 11 // static |
12 BookmarkUndoService* BookmarkUndoServiceFactory::GetForProfile( | 12 BookmarkUndoService* BookmarkUndoServiceFactory::GetForProfile( |
13 Profile* profile) { | 13 Profile* profile) { |
14 return static_cast<BookmarkUndoService*>( | 14 return static_cast<BookmarkUndoService*>( |
15 GetInstance()->GetServiceForBrowserContext(profile, true)); | 15 GetInstance()->GetServiceForBrowserContext(profile, true)); |
16 } | 16 } |
17 | 17 |
18 // static | 18 // static |
19 BookmarkUndoService* BookmarkUndoServiceFactory::GetForProfileIfExists( | 19 BookmarkUndoService* BookmarkUndoServiceFactory::GetForProfileIfExists( |
20 Profile* profile) { | 20 Profile* profile) { |
21 return static_cast<BookmarkUndoService*>( | 21 return static_cast<BookmarkUndoService*>( |
22 GetInstance()->GetServiceForBrowserContext(profile, false)); | 22 GetInstance()->GetServiceForBrowserContext(profile, false)); |
23 } | 23 } |
24 | 24 |
25 // static | 25 // static |
26 BookmarkUndoServiceFactory* BookmarkUndoServiceFactory::GetInstance() { | 26 BookmarkUndoServiceFactory* BookmarkUndoServiceFactory::GetInstance() { |
27 return Singleton<BookmarkUndoServiceFactory>::get(); | 27 return base::Singleton<BookmarkUndoServiceFactory>::get(); |
28 } | 28 } |
29 | 29 |
30 BookmarkUndoServiceFactory::BookmarkUndoServiceFactory() | 30 BookmarkUndoServiceFactory::BookmarkUndoServiceFactory() |
31 : BrowserContextKeyedServiceFactory( | 31 : BrowserContextKeyedServiceFactory( |
32 "BookmarkUndoService", | 32 "BookmarkUndoService", |
33 BrowserContextDependencyManager::GetInstance()) { | 33 BrowserContextDependencyManager::GetInstance()) { |
34 } | 34 } |
35 | 35 |
36 BookmarkUndoServiceFactory::~BookmarkUndoServiceFactory() { | 36 BookmarkUndoServiceFactory::~BookmarkUndoServiceFactory() { |
37 } | 37 } |
38 | 38 |
39 KeyedService* BookmarkUndoServiceFactory::BuildServiceInstanceFor( | 39 KeyedService* BookmarkUndoServiceFactory::BuildServiceInstanceFor( |
40 content::BrowserContext* context) const { | 40 content::BrowserContext* context) const { |
41 return new BookmarkUndoService; | 41 return new BookmarkUndoService; |
42 } | 42 } |
OLD | NEW |