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