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

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

Issue 265743004: Always install a BookmarkUndoService as a BookmarkModelObserver on iOS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 profile, OmniboxFieldTrial::BookmarksIndexURLsValue()); 58 profile, OmniboxFieldTrial::BookmarksIndexURLsValue());
59 bookmark_client->model()->Load( 59 bookmark_client->model()->Load(
60 profile->GetPrefs(), 60 profile->GetPrefs(),
61 profile->GetPrefs()->GetString(prefs::kAcceptLanguages), 61 profile->GetPrefs()->GetString(prefs::kAcceptLanguages),
62 profile->GetPath(), 62 profile->GetPath(),
63 StartupTaskRunnerServiceFactory::GetForProfile(profile) 63 StartupTaskRunnerServiceFactory::GetForProfile(profile)
64 ->GetBookmarkTaskRunner(), 64 ->GetBookmarkTaskRunner(),
65 content::BrowserThread::GetMessageLoopProxyForThread( 65 content::BrowserThread::GetMessageLoopProxyForThread(
66 content::BrowserThread::UI)); 66 content::BrowserThread::UI));
67 #if !defined(OS_ANDROID) 67 #if !defined(OS_ANDROID)
68 if (CommandLine::ForCurrentProcess()->HasSwitch( 68 #if !defined(OS_IOS)
69 switches::kEnableBookmarkUndo)) { 69 bool register_bookmark_undo_service_as_observer =
70 CommandLine::ForCurrentProcess()->HasSwitch(
71 switches::kEnableBookmarkUndo);
72 #else
73 bool register_bookmark_undo_service_as_observer = true;
blundell 2014/05/05 13:08:15 I think this would be less confusing with this lin
sdefresne 2014/05/05 14:37:11 Done.
74 #endif // !defined(OS_IOS)
75 if (register_bookmark_undo_service_as_observer) {
70 bookmark_client->model()->AddObserver( 76 bookmark_client->model()->AddObserver(
71 BookmarkUndoServiceFactory::GetForProfile(profile)); 77 BookmarkUndoServiceFactory::GetForProfile(profile));
72 } 78 }
73 #endif // !defined(OS_ANDROID) 79 #endif // !defined(OS_ANDROID)
74 return bookmark_client; 80 return bookmark_client;
75 } 81 }
76 82
77 void BookmarkModelFactory::RegisterProfilePrefs( 83 void BookmarkModelFactory::RegisterProfilePrefs(
78 user_prefs::PrefRegistrySyncable* registry) { 84 user_prefs::PrefRegistrySyncable* registry) {
79 // 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
80 // 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
81 // 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
82 // 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).
83 registry->RegisterListPref(prefs::kBookmarkEditorExpandedNodes, 89 registry->RegisterListPref(prefs::kBookmarkEditorExpandedNodes,
84 new base::ListValue, 90 new base::ListValue,
85 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 91 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
86 } 92 }
87 93
88 content::BrowserContext* BookmarkModelFactory::GetBrowserContextToUse( 94 content::BrowserContext* BookmarkModelFactory::GetBrowserContextToUse(
89 content::BrowserContext* context) const { 95 content::BrowserContext* context) const {
90 return chrome::GetBrowserContextRedirectedInIncognito(context); 96 return chrome::GetBrowserContextRedirectedInIncognito(context);
91 } 97 }
92 98
93 bool BookmarkModelFactory::ServiceIsNULLWhileTesting() const { 99 bool BookmarkModelFactory::ServiceIsNULLWhileTesting() const {
94 return true; 100 return true;
95 } 101 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698