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

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

Issue 2529283002: Save favicon during reading list distillation (Closed)
Patch Set: Using web state Created 4 years 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 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 "ios/chrome/browser/dom_distiller/dom_distiller_service_factory.h" 5 #include "ios/chrome/browser/dom_distiller/dom_distiller_service_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/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "base/memory/ptr_util.h"
12 #include "base/memory/singleton.h" 13 #include "base/memory/singleton.h"
13 #include "base/threading/sequenced_worker_pool.h" 14 #include "base/threading/sequenced_worker_pool.h"
14 #include "components/dom_distiller/core/article_entry.h" 15 #include "components/dom_distiller/core/article_entry.h"
15 #include "components/dom_distiller/core/distiller.h" 16 #include "components/dom_distiller/core/distiller.h"
16 #include "components/dom_distiller/core/dom_distiller_service.h" 17 #include "components/dom_distiller/core/dom_distiller_service.h"
17 #include "components/dom_distiller/core/dom_distiller_store.h" 18 #include "components/dom_distiller/core/dom_distiller_store.h"
18 #include "components/dom_distiller/ios/distiller_page_factory_ios.h" 19 #include "components/dom_distiller/ios/distiller_page_factory_ios.h"
19 #include "components/keyed_service/core/keyed_service.h" 20 #include "components/keyed_service/core/keyed_service.h"
20 #include "components/keyed_service/ios/browser_state_dependency_manager.h" 21 #include "components/keyed_service/ios/browser_state_dependency_manager.h"
21 #include "components/leveldb_proto/proto_database.h" 22 #include "components/leveldb_proto/proto_database.h"
22 #include "components/leveldb_proto/proto_database_impl.h" 23 #include "components/leveldb_proto/proto_database_impl.h"
23 #include "ios/chrome/browser/browser_state/browser_state_otr_helper.h" 24 #include "ios/chrome/browser/browser_state/browser_state_otr_helper.h"
24 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" 25 #include "ios/chrome/browser/browser_state/chrome_browser_state.h"
26 #include "ios/chrome/browser/dom_distiller/favicon_observer_factory_impl.h"
25 #include "ios/web/public/browser_state.h" 27 #include "ios/web/public/browser_state.h"
26 #include "ios/web/public/web_thread.h" 28 #include "ios/web/public/web_thread.h"
27 29
28 namespace { 30 namespace {
29 // A simple wrapper for DomDistillerService to expose it as a 31 // A simple wrapper for DomDistillerService to expose it as a
30 // KeyedService. 32 // KeyedService.
31 class DomDistillerKeyedService 33 class DomDistillerKeyedService
32 : public KeyedService, 34 : public KeyedService,
33 public dom_distiller::DomDistillerService { 35 public dom_distiller::DomDistillerService {
34 public: 36 public:
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 std::unique_ptr<leveldb_proto::ProtoDatabaseImpl<ArticleEntry>> db( 85 std::unique_ptr<leveldb_proto::ProtoDatabaseImpl<ArticleEntry>> db(
84 new leveldb_proto::ProtoDatabaseImpl<ArticleEntry>( 86 new leveldb_proto::ProtoDatabaseImpl<ArticleEntry>(
85 background_task_runner)); 87 background_task_runner));
86 88
87 base::FilePath database_dir( 89 base::FilePath database_dir(
88 context->GetStatePath().Append(FILE_PATH_LITERAL("Articles"))); 90 context->GetStatePath().Append(FILE_PATH_LITERAL("Articles")));
89 91
90 std::unique_ptr<DomDistillerStore> dom_distiller_store( 92 std::unique_ptr<DomDistillerStore> dom_distiller_store(
91 new DomDistillerStore(std::move(db), database_dir)); 93 new DomDistillerStore(std::move(db), database_dir));
92 94
95 std::unique_ptr<FaviconObserverFactory> web_controller_provider_factory =
kkhorimoto 2016/12/08 22:15:24 s/web_controller_provider/favicon_observer for var
96 base::MakeUnique<FaviconObserverFactoryImpl>();
93 std::unique_ptr<DistillerPageFactory> distiller_page_factory( 97 std::unique_ptr<DistillerPageFactory> distiller_page_factory(
94 new DistillerPageFactoryIOS(context)); 98 new DistillerPageFactoryIOS(context,
99 web_controller_provider_factory.get()));
100
95 std::unique_ptr<DistillerURLFetcherFactory> distiller_url_fetcher_factory( 101 std::unique_ptr<DistillerURLFetcherFactory> distiller_url_fetcher_factory(
96 new DistillerURLFetcherFactory(context->GetRequestContext())); 102 new DistillerURLFetcherFactory(context->GetRequestContext()));
97 103
98 dom_distiller::proto::DomDistillerOptions options; 104 dom_distiller::proto::DomDistillerOptions options;
99 std::unique_ptr<DistillerFactory> distiller_factory(new DistillerFactoryImpl( 105 std::unique_ptr<DistillerFactory> distiller_factory(new DistillerFactoryImpl(
100 std::move(distiller_url_fetcher_factory), options)); 106 std::move(distiller_url_fetcher_factory), options));
101 std::unique_ptr<DistilledPagePrefs> distilled_page_prefs( 107 std::unique_ptr<DistilledPagePrefs> distilled_page_prefs(
102 new DistilledPagePrefs( 108 new DistilledPagePrefs(
103 ios::ChromeBrowserState::FromBrowserState(context)->GetPrefs())); 109 ios::ChromeBrowserState::FromBrowserState(context)->GetPrefs()));
104 110
105 return base::MakeUnique<DomDistillerKeyedService>( 111 return base::MakeUnique<DomDistillerKeyedService>(
106 std::move(dom_distiller_store), std::move(distiller_factory), 112 std::move(dom_distiller_store), std::move(distiller_factory),
107 std::move(distiller_page_factory), std::move(distilled_page_prefs)); 113 std::move(distiller_page_factory), std::move(distilled_page_prefs));
108 } 114 }
109 115
110 web::BrowserState* DomDistillerServiceFactory::GetBrowserStateToUse( 116 web::BrowserState* DomDistillerServiceFactory::GetBrowserStateToUse(
111 web::BrowserState* context) const { 117 web::BrowserState* context) const {
112 // Makes normal profile and off-the-record profile use same service instance. 118 // Makes normal profile and off-the-record profile use same service instance.
113 return GetBrowserStateRedirectedInIncognito(context); 119 return GetBrowserStateRedirectedInIncognito(context);
114 } 120 }
115 121
116 } // namespace dom_distiller 122 } // namespace dom_distiller
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698