OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bookmarks/bookmark_model_factory.h" | 5 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/deferred_sequenced_task_runner.h" | 8 #include "base/deferred_sequenced_task_runner.h" |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "components/bookmarks/browser/bookmark_utils.h" | 22 #include "components/bookmarks/browser/bookmark_utils.h" |
23 #include "components/bookmarks/browser/startup_task_runner_service.h" | 23 #include "components/bookmarks/browser/startup_task_runner_service.h" |
24 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 24 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
25 #include "components/prefs/pref_service.h" | 25 #include "components/prefs/pref_service.h" |
26 #include "components/undo/bookmark_undo_service.h" | 26 #include "components/undo/bookmark_undo_service.h" |
27 #include "content/public/browser/browser_thread.h" | 27 #include "content/public/browser/browser_thread.h" |
28 | 28 |
29 using bookmarks::BookmarkModel; | 29 using bookmarks::BookmarkModel; |
30 | 30 |
31 // static | 31 // static |
| 32 BookmarkModel* BookmarkModelFactory::GetForBrowserContext( |
| 33 content::BrowserContext* browser_context) { |
| 34 return static_cast<BookmarkModel*>( |
| 35 GetInstance()->GetServiceForBrowserContext(browser_context, true)); |
| 36 } |
| 37 |
| 38 // static |
32 BookmarkModel* BookmarkModelFactory::GetForProfile(Profile* profile) { | 39 BookmarkModel* BookmarkModelFactory::GetForProfile(Profile* profile) { |
33 return static_cast<BookmarkModel*>( | 40 return static_cast<BookmarkModel*>( |
34 GetInstance()->GetServiceForBrowserContext(profile, true)); | 41 GetInstance()->GetServiceForBrowserContext(profile, true)); |
35 } | 42 } |
36 | 43 |
37 // static | 44 // static |
38 BookmarkModel* BookmarkModelFactory::GetForProfileIfExists(Profile* profile) { | 45 BookmarkModel* BookmarkModelFactory::GetForProfileIfExists(Profile* profile) { |
39 return static_cast<BookmarkModel*>( | 46 return static_cast<BookmarkModel*>( |
40 GetInstance()->GetServiceForBrowserContext(profile, false)); | 47 GetInstance()->GetServiceForBrowserContext(profile, false)); |
41 } | 48 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 } | 93 } |
87 | 94 |
88 content::BrowserContext* BookmarkModelFactory::GetBrowserContextToUse( | 95 content::BrowserContext* BookmarkModelFactory::GetBrowserContextToUse( |
89 content::BrowserContext* context) const { | 96 content::BrowserContext* context) const { |
90 return chrome::GetBrowserContextRedirectedInIncognito(context); | 97 return chrome::GetBrowserContextRedirectedInIncognito(context); |
91 } | 98 } |
92 | 99 |
93 bool BookmarkModelFactory::ServiceIsNULLWhileTesting() const { | 100 bool BookmarkModelFactory::ServiceIsNULLWhileTesting() const { |
94 return true; | 101 return true; |
95 } | 102 } |
OLD | NEW |