Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3037)

Unified Diff: chrome/browser/bookmarks/bookmark_model_factory.cc

Issue 10399087: Converting BookmarkModel and HistoryService to ProfileKeyedServices. This just performs the initial… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/bookmarks/bookmark_model_factory.h ('k') | chrome/browser/history/history.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/bookmarks/bookmark_model_factory.cc
===================================================================
--- chrome/browser/bookmarks/bookmark_model_factory.cc (revision 0)
+++ chrome/browser/bookmarks/bookmark_model_factory.cc (revision 0)
@@ -0,0 +1,58 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/bookmarks/bookmark_model_factory.h"
+
+#include "chrome/browser/bookmarks/bookmark_model.h"
+#include "chrome/browser/history/history_service_factory.h"
+#include "chrome/browser/prefs/pref_service.h"
+#include "chrome/browser/profiles/profile_dependency_manager.h"
+#include "chrome/common/pref_names.h"
+
+// static
+BookmarkModel* BookmarkModelFactory::GetForProfile(Profile* profile) {
+ return static_cast<BookmarkModel*>(
+ GetInstance()->GetServiceForProfile(profile, true));
+}
+
+BookmarkModel* BookmarkModelFactory::GetForProfileIfExists(Profile* profile) {
+ return static_cast<BookmarkModel*>(
+ GetInstance()->GetServiceForProfile(profile, false));
+}
+
+// static
+BookmarkModelFactory* BookmarkModelFactory::GetInstance() {
+ return Singleton<BookmarkModelFactory>::get();
+}
+
+BookmarkModelFactory::BookmarkModelFactory()
+ : ProfileKeyedServiceFactory("BookmarkModelFactory",
+ ProfileDependencyManager::GetInstance()) {
+}
+
+BookmarkModelFactory::~BookmarkModelFactory() {}
+
+ProfileKeyedService* BookmarkModelFactory::BuildServiceInstanceFor(
+ Profile* profile) const {
+ BookmarkModel* bookmark_model = new BookmarkModel(profile);
+ bookmark_model->Load();
+ return bookmark_model;
+}
+
+void BookmarkModelFactory::RegisterUserPrefs(PrefService* prefs) {
+ // Don't sync this, as otherwise, due to a limitation in sync, it
+ // will cause a deadlock (see http://crbug.com/97955). If we truly
+ // want to sync the expanded state of folders, it should be part of
+ // bookmark sync itself (i.e., a property of the sync folder nodes).
+ prefs->RegisterListPref(prefs::kBookmarkEditorExpandedNodes, new ListValue,
+ PrefService::UNSYNCABLE_PREF);
+}
+
+bool BookmarkModelFactory::ServiceRedirectedInIncognito() {
+ return true;
+}
+
+bool BookmarkModelFactory::ServiceIsNULLWhileTesting() {
+ return true;
+}
Property changes on: chrome\browser\bookmarks\bookmark_model_factory.cc
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « chrome/browser/bookmarks/bookmark_model_factory.h ('k') | chrome/browser/history/history.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698