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

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

Issue 14141006: [components] Switch {RefCounted}ProfileKeyedService to use BrowserContext (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 "base/values.h"
9 #include "chrome/browser/bookmarks/bookmark_model.h" 9 #include "chrome/browser/bookmarks/bookmark_model.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 18 matching lines...) Expand all
29 } 29 }
30 30
31 BookmarkModelFactory::BookmarkModelFactory() 31 BookmarkModelFactory::BookmarkModelFactory()
32 : ProfileKeyedServiceFactory("BookmarkModel", 32 : ProfileKeyedServiceFactory("BookmarkModel",
33 ProfileDependencyManager::GetInstance()) { 33 ProfileDependencyManager::GetInstance()) {
34 } 34 }
35 35
36 BookmarkModelFactory::~BookmarkModelFactory() {} 36 BookmarkModelFactory::~BookmarkModelFactory() {}
37 37
38 ProfileKeyedService* BookmarkModelFactory::BuildServiceInstanceFor( 38 ProfileKeyedService* BookmarkModelFactory::BuildServiceInstanceFor(
39 Profile* profile) const { 39 content::BrowserContext* profile) const {
40 BookmarkModel* bookmark_model = new BookmarkModel(profile); 40 BookmarkModel* bookmark_model =
41 new BookmarkModel(static_cast<Profile*>(profile));
41 bookmark_model->Load(); 42 bookmark_model->Load();
42 return bookmark_model; 43 return bookmark_model;
43 } 44 }
44 45
45 void BookmarkModelFactory::RegisterUserPrefs(PrefRegistrySyncable* registry) { 46 void BookmarkModelFactory::RegisterUserPrefs(PrefRegistrySyncable* registry) {
46 // Don't sync this, as otherwise, due to a limitation in sync, it 47 // Don't sync this, as otherwise, due to a limitation in sync, it
47 // will cause a deadlock (see http://crbug.com/97955). If we truly 48 // will cause a deadlock (see http://crbug.com/97955). If we truly
48 // want to sync the expanded state of folders, it should be part of 49 // want to sync the expanded state of folders, it should be part of
49 // bookmark sync itself (i.e., a property of the sync folder nodes). 50 // bookmark sync itself (i.e., a property of the sync folder nodes).
50 registry->RegisterListPref(prefs::kBookmarkEditorExpandedNodes, 51 registry->RegisterListPref(prefs::kBookmarkEditorExpandedNodes,
51 new base::ListValue, 52 new base::ListValue,
52 PrefRegistrySyncable::UNSYNCABLE_PREF); 53 PrefRegistrySyncable::UNSYNCABLE_PREF);
53 } 54 }
54 55
55 bool BookmarkModelFactory::ServiceRedirectedInIncognito() const { 56 bool BookmarkModelFactory::ServiceRedirectedInIncognito() const {
56 return true; 57 return true;
57 } 58 }
58 59
59 bool BookmarkModelFactory::ServiceIsNULLWhileTesting() const { 60 bool BookmarkModelFactory::ServiceIsNULLWhileTesting() const {
60 return true; 61 return true;
61 } 62 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698