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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 BrowserContextKeyedService* BookmarkModelFactory::BuildServiceInstanceFor( | 43 BrowserContextKeyedService* BookmarkModelFactory::BuildServiceInstanceFor( |
44 content::BrowserContext* context) const { | 44 content::BrowserContext* context) const { |
45 Profile* profile = static_cast<Profile*>(context); | 45 Profile* profile = static_cast<Profile*>(context); |
46 BookmarkModel* bookmark_model = new BookmarkModel(profile); | 46 BookmarkModel* bookmark_model = new BookmarkModel(profile); |
47 bookmark_model->Load(StartupTaskRunnerServiceFactory::GetForProfile(profile)-> | 47 bookmark_model->Load(StartupTaskRunnerServiceFactory::GetForProfile(profile)-> |
48 GetBookmarkTaskRunner()); | 48 GetBookmarkTaskRunner()); |
49 return bookmark_model; | 49 return bookmark_model; |
50 } | 50 } |
51 | 51 |
52 void BookmarkModelFactory::RegisterUserPrefs( | 52 void BookmarkModelFactory::RegisterProfilePrefs( |
53 user_prefs::PrefRegistrySyncable* registry) { | 53 user_prefs::PrefRegistrySyncable* registry) { |
54 // Don't sync this, as otherwise, due to a limitation in sync, it | 54 // Don't sync this, as otherwise, due to a limitation in sync, it |
55 // will cause a deadlock (see http://crbug.com/97955). If we truly | 55 // will cause a deadlock (see http://crbug.com/97955). If we truly |
56 // want to sync the expanded state of folders, it should be part of | 56 // want to sync the expanded state of folders, it should be part of |
57 // bookmark sync itself (i.e., a property of the sync folder nodes). | 57 // bookmark sync itself (i.e., a property of the sync folder nodes). |
58 registry->RegisterListPref(prefs::kBookmarkEditorExpandedNodes, | 58 registry->RegisterListPref(prefs::kBookmarkEditorExpandedNodes, |
59 new base::ListValue, | 59 new base::ListValue, |
60 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 60 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
61 } | 61 } |
62 | 62 |
63 content::BrowserContext* BookmarkModelFactory::GetBrowserContextToUse( | 63 content::BrowserContext* BookmarkModelFactory::GetBrowserContextToUse( |
64 content::BrowserContext* context) const { | 64 content::BrowserContext* context) const { |
65 return chrome::GetBrowserContextRedirectedInIncognito(context); | 65 return chrome::GetBrowserContextRedirectedInIncognito(context); |
66 } | 66 } |
67 | 67 |
68 bool BookmarkModelFactory::ServiceIsNULLWhileTesting() const { | 68 bool BookmarkModelFactory::ServiceIsNULLWhileTesting() const { |
69 return true; | 69 return true; |
70 } | 70 } |
OLD | NEW |