| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 DependsOn(StartupTaskRunnerServiceFactory::GetInstance()); | 56 DependsOn(StartupTaskRunnerServiceFactory::GetInstance()); |
| 57 } | 57 } |
| 58 | 58 |
| 59 BookmarkModelFactory::~BookmarkModelFactory() { | 59 BookmarkModelFactory::~BookmarkModelFactory() { |
| 60 } | 60 } |
| 61 | 61 |
| 62 KeyedService* BookmarkModelFactory::BuildServiceInstanceFor( | 62 KeyedService* BookmarkModelFactory::BuildServiceInstanceFor( |
| 63 content::BrowserContext* context) const { | 63 content::BrowserContext* context) const { |
| 64 Profile* profile = Profile::FromBrowserContext(context); | 64 Profile* profile = Profile::FromBrowserContext(context); |
| 65 BookmarkModel* bookmark_model = | 65 BookmarkModel* bookmark_model = |
| 66 new BookmarkModel(base::WrapUnique(new 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 !BUILDFLAG(ANDROID_JAVA_UI) |
| 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); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 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 |