| 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/singleton.h" | 9 #include "base/memory/singleton.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 #include "chrome/browser/bookmarks/chrome_bookmark_client.h" | 12 #include "chrome/browser/bookmarks/chrome_bookmark_client.h" |
| 13 #include "chrome/browser/bookmarks/managed_bookmark_service_factory.h" | 13 #include "chrome/browser/bookmarks/managed_bookmark_service_factory.h" |
| 14 #include "chrome/browser/bookmarks/startup_task_runner_service_factory.h" | 14 #include "chrome/browser/bookmarks/startup_task_runner_service_factory.h" |
| 15 #include "chrome/browser/profiles/incognito_helpers.h" | 15 #include "chrome/browser/profiles/incognito_helpers.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/undo/bookmark_undo_service_factory.h" | 17 #include "chrome/browser/undo/bookmark_undo_service_factory.h" |
| 18 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
| 19 #include "chrome/common/features.h" | 19 #include "chrome/common/features.h" |
| 20 #include "chrome/common/pref_names.h" | |
| 21 #include "components/bookmarks/browser/bookmark_model.h" | 20 #include "components/bookmarks/browser/bookmark_model.h" |
| 22 #include "components/bookmarks/browser/bookmark_utils.h" | 21 #include "components/bookmarks/browser/bookmark_utils.h" |
| 23 #include "components/bookmarks/browser/startup_task_runner_service.h" | 22 #include "components/bookmarks/browser/startup_task_runner_service.h" |
| 24 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 23 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 25 #include "components/prefs/pref_service.h" | 24 #include "components/prefs/pref_service.h" |
| 26 #include "components/undo/bookmark_undo_service.h" | 25 #include "components/undo/bookmark_undo_service.h" |
| 27 #include "content/public/browser/browser_thread.h" | 26 #include "content/public/browser/browser_thread.h" |
| 28 | 27 |
| 29 #if BUILDFLAG(ANDROID_JAVA_UI) | 28 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 30 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" | 29 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 BookmarkModelFactory::~BookmarkModelFactory() { | 67 BookmarkModelFactory::~BookmarkModelFactory() { |
| 69 } | 68 } |
| 70 | 69 |
| 71 KeyedService* BookmarkModelFactory::BuildServiceInstanceFor( | 70 KeyedService* BookmarkModelFactory::BuildServiceInstanceFor( |
| 72 content::BrowserContext* context) const { | 71 content::BrowserContext* context) const { |
| 73 Profile* profile = Profile::FromBrowserContext(context); | 72 Profile* profile = Profile::FromBrowserContext(context); |
| 74 BookmarkModel* bookmark_model = | 73 BookmarkModel* bookmark_model = |
| 75 new BookmarkModel(make_scoped_ptr(new ChromeBookmarkClient( | 74 new BookmarkModel(make_scoped_ptr(new ChromeBookmarkClient( |
| 76 profile, ManagedBookmarkServiceFactory::GetForProfile(profile)))); | 75 profile, ManagedBookmarkServiceFactory::GetForProfile(profile)))); |
| 77 bookmark_model->Load(profile->GetPrefs(), | 76 bookmark_model->Load(profile->GetPrefs(), |
| 78 profile->GetPrefs()->GetString(prefs::kAcceptLanguages), | |
| 79 profile->GetPath(), | 77 profile->GetPath(), |
| 80 StartupTaskRunnerServiceFactory::GetForProfile(profile) | 78 StartupTaskRunnerServiceFactory::GetForProfile(profile) |
| 81 ->GetBookmarkTaskRunner(), | 79 ->GetBookmarkTaskRunner(), |
| 82 content::BrowserThread::GetMessageLoopProxyForThread( | 80 content::BrowserThread::GetMessageLoopProxyForThread( |
| 83 content::BrowserThread::UI)); | 81 content::BrowserThread::UI)); |
| 84 bool register_bookmark_undo_service_as_observer = true; | 82 bool register_bookmark_undo_service_as_observer = true; |
| 85 #if !BUILDFLAG(ANDROID_JAVA_UI) | 83 #if !BUILDFLAG(ANDROID_JAVA_UI) |
| 86 register_bookmark_undo_service_as_observer = | 84 register_bookmark_undo_service_as_observer = |
| 87 base::CommandLine::ForCurrentProcess()->HasSwitch( | 85 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 88 switches::kEnableBookmarkUndo); | 86 switches::kEnableBookmarkUndo); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 108 } | 106 } |
| 109 | 107 |
| 110 content::BrowserContext* BookmarkModelFactory::GetBrowserContextToUse( | 108 content::BrowserContext* BookmarkModelFactory::GetBrowserContextToUse( |
| 111 content::BrowserContext* context) const { | 109 content::BrowserContext* context) const { |
| 112 return chrome::GetBrowserContextRedirectedInIncognito(context); | 110 return chrome::GetBrowserContextRedirectedInIncognito(context); |
| 113 } | 111 } |
| 114 | 112 |
| 115 bool BookmarkModelFactory::ServiceIsNULLWhileTesting() const { | 113 bool BookmarkModelFactory::ServiceIsNULLWhileTesting() const { |
| 116 return true; | 114 return true; |
| 117 } | 115 } |
| OLD | NEW |