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

Side by Side Diff: chrome/browser/bookmarks/bookmark_model_factory.cc

Issue 12079097: Introduce PrefRegistrySyncable, simplifying PrefServiceSyncable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: One more merge to head. Created 7 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/memory/singleton.h" 7 #include "base/memory/singleton.h"
8 #include "base/values.h"
8 #include "chrome/browser/bookmarks/bookmark_model.h" 9 #include "chrome/browser/bookmarks/bookmark_model.h"
9 #include "chrome/browser/prefs/pref_service_syncable.h" 10 #include "chrome/browser/prefs/pref_registry_syncable.h"
10 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/profiles/profile_dependency_manager.h" 12 #include "chrome/browser/profiles/profile_dependency_manager.h"
12 #include "chrome/common/pref_names.h" 13 #include "chrome/common/pref_names.h"
13 14
14 // static 15 // static
15 BookmarkModel* BookmarkModelFactory::GetForProfile(Profile* profile) { 16 BookmarkModel* BookmarkModelFactory::GetForProfile(Profile* profile) {
16 return static_cast<BookmarkModel*>( 17 return static_cast<BookmarkModel*>(
17 GetInstance()->GetServiceForProfile(profile, true)); 18 GetInstance()->GetServiceForProfile(profile, true));
18 } 19 }
19 20
(...skipping 14 matching lines...) Expand all
34 35
35 BookmarkModelFactory::~BookmarkModelFactory() {} 36 BookmarkModelFactory::~BookmarkModelFactory() {}
36 37
37 ProfileKeyedService* BookmarkModelFactory::BuildServiceInstanceFor( 38 ProfileKeyedService* BookmarkModelFactory::BuildServiceInstanceFor(
38 Profile* profile) const { 39 Profile* profile) const {
39 BookmarkModel* bookmark_model = new BookmarkModel(profile); 40 BookmarkModel* bookmark_model = new BookmarkModel(profile);
40 bookmark_model->Load(); 41 bookmark_model->Load();
41 return bookmark_model; 42 return bookmark_model;
42 } 43 }
43 44
44 void BookmarkModelFactory::RegisterUserPrefs(PrefServiceSyncable* prefs) { 45 void BookmarkModelFactory::RegisterUserPrefs(PrefRegistrySyncable* registry) {
45 // Don't sync this, as otherwise, due to a limitation in sync, it 46 // Don't sync this, as otherwise, due to a limitation in sync, it
46 // will cause a deadlock (see http://crbug.com/97955). If we truly 47 // will cause a deadlock (see http://crbug.com/97955). If we truly
47 // want to sync the expanded state of folders, it should be part of 48 // want to sync the expanded state of folders, it should be part of
48 // bookmark sync itself (i.e., a property of the sync folder nodes). 49 // bookmark sync itself (i.e., a property of the sync folder nodes).
49 prefs->RegisterListPref(prefs::kBookmarkEditorExpandedNodes, new ListValue, 50 registry->RegisterListPref(prefs::kBookmarkEditorExpandedNodes,
50 PrefServiceSyncable::UNSYNCABLE_PREF); 51 new base::ListValue,
52 PrefRegistrySyncable::UNSYNCABLE_PREF);
51 } 53 }
52 54
53 bool BookmarkModelFactory::ServiceRedirectedInIncognito() const { 55 bool BookmarkModelFactory::ServiceRedirectedInIncognito() const {
54 return true; 56 return true;
55 } 57 }
56 58
57 bool BookmarkModelFactory::ServiceIsNULLWhileTesting() const { 59 bool BookmarkModelFactory::ServiceIsNULLWhileTesting() const {
58 return true; 60 return true;
59 } 61 }
60 62
61 // static 63 // static
62 BookmarkService* BookmarkService::FromBrowserContext( 64 BookmarkService* BookmarkService::FromBrowserContext(
63 content::BrowserContext* browser_context) { 65 content::BrowserContext* browser_context) {
64 return BookmarkModelFactory::GetForProfile( 66 return BookmarkModelFactory::GetForProfile(
65 Profile::FromBrowserContext(browser_context)); 67 Profile::FromBrowserContext(browser_context));
66 } 68 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698