| OLD | NEW |
| 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/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 Profile* profile = Profile::FromBrowserContext(context); | 64 Profile* profile = Profile::FromBrowserContext(context); |
| 65 BookmarkModel* bookmark_model = | 65 BookmarkModel* bookmark_model = |
| 66 new BookmarkModel(base::MakeUnique<ChromeBookmarkClient>( | 66 new BookmarkModel(base::MakeUnique<ChromeBookmarkClient>( |
| 67 profile, ManagedBookmarkServiceFactory::GetForProfile(profile))); | 67 profile, ManagedBookmarkServiceFactory::GetForProfile(profile))); |
| 68 bookmark_model->Load(profile->GetPrefs(), profile->GetPath(), | 68 bookmark_model->Load(profile->GetPrefs(), profile->GetPath(), |
| 69 StartupTaskRunnerServiceFactory::GetForProfile(profile) | 69 StartupTaskRunnerServiceFactory::GetForProfile(profile) |
| 70 ->GetBookmarkTaskRunner(), | 70 ->GetBookmarkTaskRunner(), |
| 71 content::BrowserThread::GetTaskRunnerForThread( | 71 content::BrowserThread::GetTaskRunnerForThread( |
| 72 content::BrowserThread::UI)); | 72 content::BrowserThread::UI)); |
| 73 bool register_bookmark_undo_service_as_observer = true; | 73 bool register_bookmark_undo_service_as_observer = true; |
| 74 #if !BUILDFLAG(ANDROID_JAVA_UI) | 74 #if !defined(OS_ANDROID) |
| 75 register_bookmark_undo_service_as_observer = | 75 register_bookmark_undo_service_as_observer = |
| 76 base::CommandLine::ForCurrentProcess()->HasSwitch( | 76 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 77 switches::kEnableBookmarkUndo); | 77 switches::kEnableBookmarkUndo); |
| 78 #endif // !BUILDFLAG(ANDROID_JAVA_UI) | 78 #endif // !defined(OS_ANDROID) |
| 79 if (register_bookmark_undo_service_as_observer) | 79 if (register_bookmark_undo_service_as_observer) |
| 80 BookmarkUndoServiceFactory::GetForProfile(profile)->Start(bookmark_model); | 80 BookmarkUndoServiceFactory::GetForProfile(profile)->Start(bookmark_model); |
| 81 | 81 |
| 82 return bookmark_model; | 82 return bookmark_model; |
| 83 } | 83 } |
| 84 | 84 |
| 85 void BookmarkModelFactory::RegisterProfilePrefs( | 85 void BookmarkModelFactory::RegisterProfilePrefs( |
| 86 user_prefs::PrefRegistrySyncable* registry) { | 86 user_prefs::PrefRegistrySyncable* registry) { |
| 87 bookmarks::RegisterProfilePrefs(registry); | 87 bookmarks::RegisterProfilePrefs(registry); |
| 88 } | 88 } |
| 89 | 89 |
| 90 content::BrowserContext* BookmarkModelFactory::GetBrowserContextToUse( | 90 content::BrowserContext* BookmarkModelFactory::GetBrowserContextToUse( |
| 91 content::BrowserContext* context) const { | 91 content::BrowserContext* context) const { |
| 92 return chrome::GetBrowserContextRedirectedInIncognito(context); | 92 return chrome::GetBrowserContextRedirectedInIncognito(context); |
| 93 } | 93 } |
| 94 | 94 |
| 95 bool BookmarkModelFactory::ServiceIsNULLWhileTesting() const { | 95 bool BookmarkModelFactory::ServiceIsNULLWhileTesting() const { |
| 96 return true; | 96 return true; |
| 97 } | 97 } |
| OLD | NEW |