| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/android/offline_pages/offline_page_model_factory.h" | 5 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "base/sequenced_task_runner.h" | 12 #include "base/sequenced_task_runner.h" |
| 13 #include "chrome/browser/browser_process.h" |
| 13 #include "chrome/browser/profiles/incognito_helpers.h" | 14 #include "chrome/browser/profiles/incognito_helpers.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/common/chrome_constants.h" | 16 #include "chrome/common/chrome_constants.h" |
| 16 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 17 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 17 #include "components/offline_pages/offline_page_metadata_store_sql.h" | 18 #include "components/offline_pages/offline_page_metadata_store_sql.h" |
| 18 #include "components/offline_pages/offline_page_model.h" | 19 #include "components/offline_pages/offline_page_model.h" |
| 19 #include "components/offline_pages/proto/offline_pages.pb.h" | 20 #include "components/offline_pages/proto/offline_pages.pb.h" |
| 21 #include "components/rappor/rappor_service.h" |
| 20 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
| 21 | 23 |
| 22 namespace offline_pages { | 24 namespace offline_pages { |
| 23 | 25 |
| 24 OfflinePageModelFactory::OfflinePageModelFactory() | 26 OfflinePageModelFactory::OfflinePageModelFactory() |
| 25 : BrowserContextKeyedServiceFactory( | 27 : BrowserContextKeyedServiceFactory( |
| 26 "OfflinePageModel", | 28 "OfflinePageModel", |
| 27 BrowserContextDependencyManager::GetInstance()) { | 29 BrowserContextDependencyManager::GetInstance()) { |
| 28 } | 30 } |
| 29 | 31 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 48 | 50 |
| 49 base::FilePath store_path = | 51 base::FilePath store_path = |
| 50 profile->GetPath().Append(chrome::kOfflinePageMetadataDirname); | 52 profile->GetPath().Append(chrome::kOfflinePageMetadataDirname); |
| 51 std::unique_ptr<OfflinePageMetadataStore> metadata_store( | 53 std::unique_ptr<OfflinePageMetadataStore> metadata_store( |
| 52 new OfflinePageMetadataStoreSQL(background_task_runner, store_path)); | 54 new OfflinePageMetadataStoreSQL(background_task_runner, store_path)); |
| 53 | 55 |
| 54 base::FilePath archives_dir = | 56 base::FilePath archives_dir = |
| 55 profile->GetPath().Append(chrome::kOfflinePageArchviesDirname); | 57 profile->GetPath().Append(chrome::kOfflinePageArchviesDirname); |
| 56 | 58 |
| 57 return new OfflinePageModel(std::move(metadata_store), archives_dir, | 59 return new OfflinePageModel(std::move(metadata_store), archives_dir, |
| 60 g_browser_process->rappor_service()->AsWeakPtr(), |
| 58 background_task_runner); | 61 background_task_runner); |
| 59 } | 62 } |
| 60 | 63 |
| 61 content::BrowserContext* OfflinePageModelFactory::GetBrowserContextToUse( | 64 content::BrowserContext* OfflinePageModelFactory::GetBrowserContextToUse( |
| 62 content::BrowserContext* context) const { | 65 content::BrowserContext* context) const { |
| 63 return chrome::GetBrowserContextRedirectedInIncognito(context); | 66 return chrome::GetBrowserContextRedirectedInIncognito(context); |
| 64 } | 67 } |
| 65 | 68 |
| 66 } // namespace offline_pages | 69 } // namespace offline_pages |
| 67 | 70 |
| OLD | NEW |