| 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" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 OfflinePageModel* OfflinePageModelFactory::GetForBrowserContext( | 34 OfflinePageModel* OfflinePageModelFactory::GetForBrowserContext( |
| 35 content::BrowserContext* context) { | 35 content::BrowserContext* context) { |
| 36 return static_cast<OfflinePageModelImpl*>( | 36 return static_cast<OfflinePageModelImpl*>( |
| 37 GetInstance()->GetServiceForBrowserContext(context, true)); | 37 GetInstance()->GetServiceForBrowserContext(context, true)); |
| 38 } | 38 } |
| 39 | 39 |
| 40 KeyedService* OfflinePageModelFactory::BuildServiceInstanceFor( | 40 KeyedService* OfflinePageModelFactory::BuildServiceInstanceFor( |
| 41 content::BrowserContext* context) const { | 41 content::BrowserContext* context) const { |
| 42 Profile* profile = Profile::FromBrowserContext(context); | 42 Profile* profile = Profile::FromBrowserContext(context); |
| 43 scoped_refptr<base::SequencedTaskRunner> background_task_runner = | 43 scoped_refptr<base::SequencedTaskRunner> background_task_runner = |
| 44 base::CreateSequencedTaskRunnerWithTraits(base::TaskTraits().MayBlock()); | 44 base::CreateSequencedTaskRunnerWithTraits({base::MayBlock()}); |
| 45 | 45 |
| 46 base::FilePath store_path = | 46 base::FilePath store_path = |
| 47 profile->GetPath().Append(chrome::kOfflinePageMetadataDirname); | 47 profile->GetPath().Append(chrome::kOfflinePageMetadataDirname); |
| 48 std::unique_ptr<OfflinePageMetadataStore> metadata_store( | 48 std::unique_ptr<OfflinePageMetadataStore> metadata_store( |
| 49 new OfflinePageMetadataStoreSQL(background_task_runner, store_path)); | 49 new OfflinePageMetadataStoreSQL(background_task_runner, store_path)); |
| 50 | 50 |
| 51 base::FilePath archives_dir = | 51 base::FilePath archives_dir = |
| 52 profile->GetPath().Append(chrome::kOfflinePageArchivesDirname); | 52 profile->GetPath().Append(chrome::kOfflinePageArchivesDirname); |
| 53 | 53 |
| 54 return new OfflinePageModelImpl(std::move(metadata_store), archives_dir, | 54 return new OfflinePageModelImpl(std::move(metadata_store), archives_dir, |
| 55 background_task_runner); | 55 background_task_runner); |
| 56 } | 56 } |
| 57 | 57 |
| 58 } // namespace offline_pages | 58 } // namespace offline_pages |
| OLD | NEW |