| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/dom_distiller/dom_distiller_service_factory.h" | 5 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/task_scheduler/post_task.h" | 9 #include "base/task_scheduler/post_task.h" |
| 10 #include "chrome/browser/profiles/incognito_helpers.h" | 10 #include "chrome/browser/profiles/incognito_helpers.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 : BrowserContextKeyedServiceFactory( | 48 : BrowserContextKeyedServiceFactory( |
| 49 "DomDistillerService", | 49 "DomDistillerService", |
| 50 BrowserContextDependencyManager::GetInstance()) {} | 50 BrowserContextDependencyManager::GetInstance()) {} |
| 51 | 51 |
| 52 DomDistillerServiceFactory::~DomDistillerServiceFactory() {} | 52 DomDistillerServiceFactory::~DomDistillerServiceFactory() {} |
| 53 | 53 |
| 54 KeyedService* DomDistillerServiceFactory::BuildServiceInstanceFor( | 54 KeyedService* DomDistillerServiceFactory::BuildServiceInstanceFor( |
| 55 content::BrowserContext* profile) const { | 55 content::BrowserContext* profile) const { |
| 56 scoped_refptr<base::SequencedTaskRunner> background_task_runner = | 56 scoped_refptr<base::SequencedTaskRunner> background_task_runner = |
| 57 base::CreateSequencedTaskRunnerWithTraits( | 57 base::CreateSequencedTaskRunnerWithTraits( |
| 58 base::TaskTraits().MayBlock().WithPriority( | 58 {base::MayBlock(), base::TaskPriority::BACKGROUND}); |
| 59 base::TaskPriority::BACKGROUND)); | |
| 60 | 59 |
| 61 std::unique_ptr<leveldb_proto::ProtoDatabaseImpl<ArticleEntry>> db( | 60 std::unique_ptr<leveldb_proto::ProtoDatabaseImpl<ArticleEntry>> db( |
| 62 new leveldb_proto::ProtoDatabaseImpl<ArticleEntry>( | 61 new leveldb_proto::ProtoDatabaseImpl<ArticleEntry>( |
| 63 background_task_runner)); | 62 background_task_runner)); |
| 64 | 63 |
| 65 base::FilePath database_dir( | 64 base::FilePath database_dir( |
| 66 profile->GetPath().Append(FILE_PATH_LITERAL("Articles"))); | 65 profile->GetPath().Append(FILE_PATH_LITERAL("Articles"))); |
| 67 | 66 |
| 68 std::unique_ptr<DomDistillerStore> dom_distiller_store( | 67 std::unique_ptr<DomDistillerStore> dom_distiller_store( |
| 69 new DomDistillerStore(std::move(db), database_dir)); | 68 new DomDistillerStore(std::move(db), database_dir)); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 98 return service; | 97 return service; |
| 99 } | 98 } |
| 100 | 99 |
| 101 content::BrowserContext* DomDistillerServiceFactory::GetBrowserContextToUse( | 100 content::BrowserContext* DomDistillerServiceFactory::GetBrowserContextToUse( |
| 102 content::BrowserContext* context) const { | 101 content::BrowserContext* context) const { |
| 103 // Makes normal profile and off-the-record profile use same service instance. | 102 // Makes normal profile and off-the-record profile use same service instance. |
| 104 return chrome::GetBrowserContextRedirectedInIncognito(context); | 103 return chrome::GetBrowserContextRedirectedInIncognito(context); |
| 105 } | 104 } |
| 106 | 105 |
| 107 } // namespace dom_distiller | 106 } // namespace dom_distiller |
| OLD | NEW |