Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(792)

Side by Side Diff: chrome/browser/dom_distiller/dom_distiller_service_factory.cc

Issue 1878153002: Revert of Simplify BrowserContext by removing redundant methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/threading/sequenced_worker_pool.h" 9 #include "base/threading/sequenced_worker_pool.h"
10 #include "chrome/browser/profiles/incognito_helpers.h" 10 #include "chrome/browser/profiles/incognito_helpers.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "components/dom_distiller/content/browser/distiller_page_web_contents.h " 12 #include "components/dom_distiller/content/browser/distiller_page_web_contents.h "
13 #include "components/dom_distiller/core/article_entry.h" 13 #include "components/dom_distiller/core/article_entry.h"
14 #include "components/dom_distiller/core/distiller.h" 14 #include "components/dom_distiller/core/distiller.h"
15 #include "components/dom_distiller/core/dom_distiller_store.h" 15 #include "components/dom_distiller/core/dom_distiller_store.h"
16 #include "components/keyed_service/content/browser_context_dependency_manager.h" 16 #include "components/keyed_service/content/browser_context_dependency_manager.h"
17 #include "components/leveldb_proto/proto_database.h" 17 #include "components/leveldb_proto/proto_database.h"
18 #include "components/leveldb_proto/proto_database_impl.h" 18 #include "components/leveldb_proto/proto_database_impl.h"
19 #include "content/public/browser/browser_context.h" 19 #include "content/public/browser/browser_context.h"
20 #include "content/public/browser/browser_thread.h" 20 #include "content/public/browser/browser_thread.h"
21 #include "content/public/browser/storage_partition.h"
22 21
23 namespace dom_distiller { 22 namespace dom_distiller {
24 23
25 DomDistillerContextKeyedService::DomDistillerContextKeyedService( 24 DomDistillerContextKeyedService::DomDistillerContextKeyedService(
26 scoped_ptr<DomDistillerStoreInterface> store, 25 scoped_ptr<DomDistillerStoreInterface> store,
27 scoped_ptr<DistillerFactory> distiller_factory, 26 scoped_ptr<DistillerFactory> distiller_factory,
28 scoped_ptr<DistillerPageFactory> distiller_page_factory, 27 scoped_ptr<DistillerPageFactory> distiller_page_factory,
29 scoped_ptr<DistilledPagePrefs> distilled_page_prefs) 28 scoped_ptr<DistilledPagePrefs> distilled_page_prefs)
30 : DomDistillerService(std::move(store), 29 : DomDistillerService(std::move(store),
31 std::move(distiller_factory), 30 std::move(distiller_factory),
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 scoped_ptr<DomDistillerStore> dom_distiller_store( 67 scoped_ptr<DomDistillerStore> dom_distiller_store(
69 new DomDistillerStore(std::move(db), database_dir)); 68 new DomDistillerStore(std::move(db), database_dir));
70 69
71 scoped_ptr<DistillerPageFactory> distiller_page_factory( 70 scoped_ptr<DistillerPageFactory> distiller_page_factory(
72 new DistillerPageWebContentsFactory(profile)); 71 new DistillerPageWebContentsFactory(profile));
73 scoped_ptr<DistillerURLFetcherFactory> distiller_url_fetcher_factory( 72 scoped_ptr<DistillerURLFetcherFactory> distiller_url_fetcher_factory(
74 new DistillerURLFetcherFactory( 73 new DistillerURLFetcherFactory(profile->GetRequestContext()));
75 content::BrowserContext::GetDefaultStoragePartition(profile)->
76 GetURLRequestContext()));
77 74
78 dom_distiller::proto::DomDistillerOptions options; 75 dom_distiller::proto::DomDistillerOptions options;
79 if (VLOG_IS_ON(1)) { 76 if (VLOG_IS_ON(1)) {
80 options.set_debug_level(logging::GetVlogLevelHelper( 77 options.set_debug_level(logging::GetVlogLevelHelper(
81 FROM_HERE.file_name(), ::strlen(FROM_HERE.file_name()))); 78 FROM_HERE.file_name(), ::strlen(FROM_HERE.file_name())));
82 } 79 }
83 // Options for pagination algorithm: 80 // Options for pagination algorithm:
84 // - "next": detect anchors with "next" text 81 // - "next": detect anchors with "next" text
85 // - "pagenum": detect anchors with numeric page numbers 82 // - "pagenum": detect anchors with numeric page numbers
86 // Default is "next". 83 // Default is "next".
(...skipping 11 matching lines...) Expand all
98 return service; 95 return service;
99 } 96 }
100 97
101 content::BrowserContext* DomDistillerServiceFactory::GetBrowserContextToUse( 98 content::BrowserContext* DomDistillerServiceFactory::GetBrowserContextToUse(
102 content::BrowserContext* context) const { 99 content::BrowserContext* context) const {
103 // Makes normal profile and off-the-record profile use same service instance. 100 // Makes normal profile and off-the-record profile use same service instance.
104 return chrome::GetBrowserContextRedirectedInIncognito(context); 101 return chrome::GetBrowserContextRedirectedInIncognito(context);
105 } 102 }
106 103
107 } // namespace dom_distiller 104 } // namespace dom_distiller
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698