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/deferred_sequenced_task_runner.h" | 7 #include "base/deferred_sequenced_task_runner.h" |
8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/bookmarks/bookmark_model.h" | 10 #include "chrome/browser/bookmarks/bookmark_model.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 } | 32 } |
33 | 33 |
34 BookmarkModelFactory::BookmarkModelFactory() | 34 BookmarkModelFactory::BookmarkModelFactory() |
35 : ProfileKeyedServiceFactory("BookmarkModel", | 35 : ProfileKeyedServiceFactory("BookmarkModel", |
36 ProfileDependencyManager::GetInstance()) { | 36 ProfileDependencyManager::GetInstance()) { |
37 } | 37 } |
38 | 38 |
39 BookmarkModelFactory::~BookmarkModelFactory() {} | 39 BookmarkModelFactory::~BookmarkModelFactory() {} |
40 | 40 |
41 ProfileKeyedService* BookmarkModelFactory::BuildServiceInstanceFor( | 41 ProfileKeyedService* BookmarkModelFactory::BuildServiceInstanceFor( |
42 Profile* profile) const { | 42 content::BrowserContext* context) const { |
| 43 Profile* profile = static_cast<Profile*>(context); |
43 BookmarkModel* bookmark_model = new BookmarkModel(profile); | 44 BookmarkModel* bookmark_model = new BookmarkModel(profile); |
44 bookmark_model->Load(StartupTaskRunnerServiceFactory::GetForProfile(profile)-> | 45 bookmark_model->Load(StartupTaskRunnerServiceFactory::GetForProfile(profile)-> |
45 GetBookmarkTaskRunner()); | 46 GetBookmarkTaskRunner()); |
46 return bookmark_model; | 47 return bookmark_model; |
47 } | 48 } |
48 | 49 |
49 void BookmarkModelFactory::RegisterUserPrefs(PrefRegistrySyncable* registry) { | 50 void BookmarkModelFactory::RegisterUserPrefs(PrefRegistrySyncable* registry) { |
50 // Don't sync this, as otherwise, due to a limitation in sync, it | 51 // Don't sync this, as otherwise, due to a limitation in sync, it |
51 // will cause a deadlock (see http://crbug.com/97955). If we truly | 52 // will cause a deadlock (see http://crbug.com/97955). If we truly |
52 // want to sync the expanded state of folders, it should be part of | 53 // want to sync the expanded state of folders, it should be part of |
53 // bookmark sync itself (i.e., a property of the sync folder nodes). | 54 // bookmark sync itself (i.e., a property of the sync folder nodes). |
54 registry->RegisterListPref(prefs::kBookmarkEditorExpandedNodes, | 55 registry->RegisterListPref(prefs::kBookmarkEditorExpandedNodes, |
55 new base::ListValue, | 56 new base::ListValue, |
56 PrefRegistrySyncable::UNSYNCABLE_PREF); | 57 PrefRegistrySyncable::UNSYNCABLE_PREF); |
57 } | 58 } |
58 | 59 |
59 bool BookmarkModelFactory::ServiceRedirectedInIncognito() const { | 60 bool BookmarkModelFactory::ServiceRedirectedInIncognito() const { |
60 return true; | 61 return true; |
61 } | 62 } |
62 | 63 |
63 bool BookmarkModelFactory::ServiceIsNULLWhileTesting() const { | 64 bool BookmarkModelFactory::ServiceIsNULLWhileTesting() const { |
64 return true; | 65 return true; |
65 } | 66 } |
OLD | NEW |