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

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

Issue 586913002: Add BookmarkUndoService to Android build (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: suspend undo service during sync changes Created 6 years, 3 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
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/command_line.h" 7 #include "base/command_line.h"
8 #include "base/deferred_sequenced_task_runner.h" 8 #include "base/deferred_sequenced_task_runner.h"
9 #include "base/memory/singleton.h" 9 #include "base/memory/singleton.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 ChromeBookmarkClientFactory::GetForProfile(profile); 60 ChromeBookmarkClientFactory::GetForProfile(profile);
61 BookmarkModel* bookmark_model = new BookmarkModel(bookmark_client); 61 BookmarkModel* bookmark_model = new BookmarkModel(bookmark_client);
62 bookmark_client->Init(bookmark_model); 62 bookmark_client->Init(bookmark_model);
63 bookmark_model->Load(profile->GetPrefs(), 63 bookmark_model->Load(profile->GetPrefs(),
64 profile->GetPrefs()->GetString(prefs::kAcceptLanguages), 64 profile->GetPrefs()->GetString(prefs::kAcceptLanguages),
65 profile->GetPath(), 65 profile->GetPath(),
66 StartupTaskRunnerServiceFactory::GetForProfile(profile) 66 StartupTaskRunnerServiceFactory::GetForProfile(profile)
67 ->GetBookmarkTaskRunner(), 67 ->GetBookmarkTaskRunner(),
68 content::BrowserThread::GetMessageLoopProxyForThread( 68 content::BrowserThread::GetMessageLoopProxyForThread(
69 content::BrowserThread::UI)); 69 content::BrowserThread::UI));
70 #if !defined(OS_ANDROID)
71 bool register_bookmark_undo_service_as_observer = true; 70 bool register_bookmark_undo_service_as_observer = true;
72 #if !defined(OS_IOS) 71 #if !defined(OS_IOS) && !defined(OS_ANDROID)
73 register_bookmark_undo_service_as_observer = 72 register_bookmark_undo_service_as_observer =
74 CommandLine::ForCurrentProcess()->HasSwitch( 73 CommandLine::ForCurrentProcess()->HasSwitch(
75 switches::kEnableBookmarkUndo); 74 switches::kEnableBookmarkUndo);
76 #endif // !defined(OS_IOS) 75 #endif // !defined(OS_IOS)
77 if (register_bookmark_undo_service_as_observer) { 76 if (register_bookmark_undo_service_as_observer) {
78 bookmark_model->AddObserver( 77 bookmark_model->AddObserver(
79 BookmarkUndoServiceFactory::GetForProfile(profile)); 78 BookmarkUndoServiceFactory::GetForProfile(profile));
80 } 79 }
81 #endif // !defined(OS_ANDROID)
82 return bookmark_model; 80 return bookmark_model;
83 } 81 }
84 82
85 void BookmarkModelFactory::RegisterProfilePrefs( 83 void BookmarkModelFactory::RegisterProfilePrefs(
86 user_prefs::PrefRegistrySyncable* registry) { 84 user_prefs::PrefRegistrySyncable* registry) {
87 // Don't sync this, as otherwise, due to a limitation in sync, it 85 // Don't sync this, as otherwise, due to a limitation in sync, it
88 // will cause a deadlock (see http://crbug.com/97955). If we truly 86 // will cause a deadlock (see http://crbug.com/97955). If we truly
89 // want to sync the expanded state of folders, it should be part of 87 // want to sync the expanded state of folders, it should be part of
90 // bookmark sync itself (i.e., a property of the sync folder nodes). 88 // bookmark sync itself (i.e., a property of the sync folder nodes).
91 registry->RegisterListPref(bookmarks::prefs::kBookmarkEditorExpandedNodes, 89 registry->RegisterListPref(bookmarks::prefs::kBookmarkEditorExpandedNodes,
92 new base::ListValue, 90 new base::ListValue,
93 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 91 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
94 registry->RegisterListPref( 92 registry->RegisterListPref(
95 bookmarks::prefs::kManagedBookmarks, 93 bookmarks::prefs::kManagedBookmarks,
96 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 94 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
97 } 95 }
98 96
99 content::BrowserContext* BookmarkModelFactory::GetBrowserContextToUse( 97 content::BrowserContext* BookmarkModelFactory::GetBrowserContextToUse(
100 content::BrowserContext* context) const { 98 content::BrowserContext* context) const {
101 return chrome::GetBrowserContextRedirectedInIncognito(context); 99 return chrome::GetBrowserContextRedirectedInIncognito(context);
102 } 100 }
103 101
104 bool BookmarkModelFactory::ServiceIsNULLWhileTesting() const { 102 bool BookmarkModelFactory::ServiceIsNULLWhileTesting() const {
105 return true; 103 return true;
106 } 104 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698