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/singleton.h" | 9 #include "base/memory/singleton.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "chrome/browser/bookmarks/bookmark_model.h" | 11 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 12 #include "chrome/browser/omnibox/omnibox_field_trial.h" |
12 #include "chrome/browser/profiles/incognito_helpers.h" | 13 #include "chrome/browser/profiles/incognito_helpers.h" |
13 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/profiles/startup_task_runner_service.h" | 15 #include "chrome/browser/profiles/startup_task_runner_service.h" |
15 #include "chrome/browser/profiles/startup_task_runner_service_factory.h" | 16 #include "chrome/browser/profiles/startup_task_runner_service_factory.h" |
16 #include "chrome/browser/undo/bookmark_undo_service.h" | 17 #include "chrome/browser/undo/bookmark_undo_service.h" |
17 #include "chrome/browser/undo/bookmark_undo_service_factory.h" | 18 #include "chrome/browser/undo/bookmark_undo_service_factory.h" |
18 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
19 #include "components/bookmarks/core/common/bookmark_pref_names.h" | 20 #include "components/bookmarks/core/common/bookmark_pref_names.h" |
20 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 21 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
21 #include "components/user_prefs/pref_registry_syncable.h" | 22 #include "components/user_prefs/pref_registry_syncable.h" |
(...skipping 18 matching lines...) Expand all Loading... |
40 : BrowserContextKeyedServiceFactory( | 41 : BrowserContextKeyedServiceFactory( |
41 "BookmarkModel", | 42 "BookmarkModel", |
42 BrowserContextDependencyManager::GetInstance()) { | 43 BrowserContextDependencyManager::GetInstance()) { |
43 } | 44 } |
44 | 45 |
45 BookmarkModelFactory::~BookmarkModelFactory() {} | 46 BookmarkModelFactory::~BookmarkModelFactory() {} |
46 | 47 |
47 KeyedService* BookmarkModelFactory::BuildServiceInstanceFor( | 48 KeyedService* BookmarkModelFactory::BuildServiceInstanceFor( |
48 content::BrowserContext* context) const { | 49 content::BrowserContext* context) const { |
49 Profile* profile = static_cast<Profile*>(context); | 50 Profile* profile = static_cast<Profile*>(context); |
50 BookmarkModel* bookmark_model = new BookmarkModel(profile); | 51 BookmarkModel* bookmark_model = |
| 52 new BookmarkModel(profile, OmniboxFieldTrial::BookmarksIndexURLsValue()); |
51 bookmark_model->Load(StartupTaskRunnerServiceFactory::GetForProfile(profile)-> | 53 bookmark_model->Load(StartupTaskRunnerServiceFactory::GetForProfile(profile)-> |
52 GetBookmarkTaskRunner()); | 54 GetBookmarkTaskRunner()); |
53 #if !defined(OS_ANDROID) | 55 #if !defined(OS_ANDROID) |
54 if (CommandLine::ForCurrentProcess()->HasSwitch( | 56 if (CommandLine::ForCurrentProcess()->HasSwitch( |
55 switches::kEnableBookmarkUndo)) { | 57 switches::kEnableBookmarkUndo)) { |
56 bookmark_model->AddObserver( | 58 bookmark_model->AddObserver( |
57 BookmarkUndoServiceFactory::GetForProfile(profile)); | 59 BookmarkUndoServiceFactory::GetForProfile(profile)); |
58 } | 60 } |
59 #endif // !defined(OS_ANDROID) | 61 #endif // !defined(OS_ANDROID) |
60 return bookmark_model; | 62 return bookmark_model; |
(...skipping 11 matching lines...) Expand all Loading... |
72 } | 74 } |
73 | 75 |
74 content::BrowserContext* BookmarkModelFactory::GetBrowserContextToUse( | 76 content::BrowserContext* BookmarkModelFactory::GetBrowserContextToUse( |
75 content::BrowserContext* context) const { | 77 content::BrowserContext* context) const { |
76 return chrome::GetBrowserContextRedirectedInIncognito(context); | 78 return chrome::GetBrowserContextRedirectedInIncognito(context); |
77 } | 79 } |
78 | 80 |
79 bool BookmarkModelFactory::ServiceIsNULLWhileTesting() const { | 81 bool BookmarkModelFactory::ServiceIsNULLWhileTesting() const { |
80 return true; | 82 return true; |
81 } | 83 } |
OLD | NEW |