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

Side by Side Diff: components/dom_distiller/standalone/content_extractor.cc

Issue 655143002: Use scoped_ptr::Pass instead of scoped_ptr::PassAs<T>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <sstream> 5 #include <sstream>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 const base::FilePath& db_path) { 69 const base::FilePath& db_path) {
70 scoped_refptr<base::SequencedTaskRunner> background_task_runner = 70 scoped_refptr<base::SequencedTaskRunner> background_task_runner =
71 content::BrowserThread::GetBlockingPool()->GetSequencedTaskRunner( 71 content::BrowserThread::GetBlockingPool()->GetSequencedTaskRunner(
72 content::BrowserThread::GetBlockingPool()->GetSequenceToken()); 72 content::BrowserThread::GetBlockingPool()->GetSequenceToken());
73 73
74 // TODO(cjhopman): use an in-memory database instead of an on-disk one with 74 // TODO(cjhopman): use an in-memory database instead of an on-disk one with
75 // temporary directory. 75 // temporary directory.
76 scoped_ptr<leveldb_proto::ProtoDatabaseImpl<ArticleEntry> > db( 76 scoped_ptr<leveldb_proto::ProtoDatabaseImpl<ArticleEntry> > db(
77 new leveldb_proto::ProtoDatabaseImpl<ArticleEntry>( 77 new leveldb_proto::ProtoDatabaseImpl<ArticleEntry>(
78 background_task_runner)); 78 background_task_runner));
79 scoped_ptr<DomDistillerStore> dom_distiller_store(new DomDistillerStore( 79 scoped_ptr<DomDistillerStore> dom_distiller_store(
80 db.PassAs<leveldb_proto::ProtoDatabase<ArticleEntry> >(), db_path)); 80 new DomDistillerStore(db.Pass(), db_path));
81 81
82 scoped_ptr<DistillerPageFactory> distiller_page_factory( 82 scoped_ptr<DistillerPageFactory> distiller_page_factory(
83 new DistillerPageWebContentsFactory(context)); 83 new DistillerPageWebContentsFactory(context));
84 scoped_ptr<DistillerURLFetcherFactory> distiller_url_fetcher_factory( 84 scoped_ptr<DistillerURLFetcherFactory> distiller_url_fetcher_factory(
85 new DistillerURLFetcherFactory(context->GetRequestContext())); 85 new DistillerURLFetcherFactory(context->GetRequestContext()));
86 86
87 dom_distiller::proto::DomDistillerOptions options; 87 dom_distiller::proto::DomDistillerOptions options;
88 if (base::CommandLine::ForCurrentProcess()->HasSwitch(kExtractTextOnly)) { 88 if (base::CommandLine::ForCurrentProcess()->HasSwitch(kExtractTextOnly)) {
89 options.set_extract_text_only(true); 89 options.set_extract_text_only(true);
90 } 90 }
91 int debug_level = 0; 91 int debug_level = 0;
92 if (base::CommandLine::ForCurrentProcess()->HasSwitch(kDebugLevel) && 92 if (base::CommandLine::ForCurrentProcess()->HasSwitch(kDebugLevel) &&
93 base::StringToInt( 93 base::StringToInt(
94 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 94 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
95 kDebugLevel), 95 kDebugLevel),
96 &debug_level)) { 96 &debug_level)) {
97 options.set_debug_level(debug_level); 97 options.set_debug_level(debug_level);
98 } 98 }
99 scoped_ptr<DistillerFactory> distiller_factory( 99 scoped_ptr<DistillerFactory> distiller_factory(
100 new DistillerFactoryImpl(distiller_url_fetcher_factory.Pass(), options)); 100 new DistillerFactoryImpl(distiller_url_fetcher_factory.Pass(), options));
101 101
102 // Setting up PrefService for DistilledPagePrefs. 102 // Setting up PrefService for DistilledPagePrefs.
103 user_prefs::TestingPrefServiceSyncable* pref_service = 103 user_prefs::TestingPrefServiceSyncable* pref_service =
104 new user_prefs::TestingPrefServiceSyncable(); 104 new user_prefs::TestingPrefServiceSyncable();
105 DistilledPagePrefs::RegisterProfilePrefs(pref_service->registry()); 105 DistilledPagePrefs::RegisterProfilePrefs(pref_service->registry());
106 106
107 return scoped_ptr<DomDistillerService>(new DomDistillerService( 107 return scoped_ptr<DomDistillerService>(new DomDistillerService(
108 dom_distiller_store.PassAs<DomDistillerStoreInterface>(), 108 dom_distiller_store.Pass(),
109 distiller_factory.Pass(), 109 distiller_factory.Pass(),
110 distiller_page_factory.Pass(), 110 distiller_page_factory.Pass(),
111 scoped_ptr<DistilledPagePrefs>( 111 scoped_ptr<DistilledPagePrefs>(new DistilledPagePrefs(pref_service))));
112 new DistilledPagePrefs(pref_service))));
113 } 112 }
114 113
115 void AddComponentsResources() { 114 void AddComponentsResources() {
116 base::FilePath pak_file; 115 base::FilePath pak_file;
117 base::FilePath pak_dir; 116 base::FilePath pak_dir;
118 PathService::Get(base::DIR_MODULE, &pak_dir); 117 PathService::Get(base::DIR_MODULE, &pak_dir);
119 pak_file = pak_dir.Append(FILE_PATH_LITERAL("components_resources.pak")); 118 pak_file = pak_dir.Append(FILE_PATH_LITERAL("components_resources.pak"));
120 ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( 119 ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath(
121 pak_file, ui::SCALE_FACTOR_NONE); 120 pak_file, ui::SCALE_FACTOR_NONE);
122 } 121 }
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 std::string output_data_; 331 std::string output_data_;
333 scoped_ptr<google::protobuf::io::StringOutputStream> protobuf_output_stream_; 332 scoped_ptr<google::protobuf::io::StringOutputStream> protobuf_output_stream_;
334 }; 333 };
335 334
336 IN_PROC_BROWSER_TEST_F(ContentExtractor, MANUAL_ExtractUrl) { 335 IN_PROC_BROWSER_TEST_F(ContentExtractor, MANUAL_ExtractUrl) {
337 Start(); 336 Start();
338 base::RunLoop().Run(); 337 base::RunLoop().Run();
339 } 338 }
340 339
341 } // namespace dom_distiller 340 } // namespace dom_distiller
OLDNEW
« no previous file with comments | « components/dom_distiller/core/dom_distiller_store_unittest.cc ('k') | components/gcm_driver/gcm_account_mapper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698