OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/ntp_tiles/ios_popular_sites_factory.h" | 5 #include "ios/chrome/browser/ntp_tiles/ios_popular_sites_factory.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
11 #include "base/threading/sequenced_worker_pool.h" | |
12 #include "components/ntp_tiles/json_unsafe_parser.h" | 11 #include "components/ntp_tiles/json_unsafe_parser.h" |
13 #include "components/ntp_tiles/popular_sites_impl.h" | 12 #include "components/ntp_tiles/popular_sites_impl.h" |
14 #include "ios/chrome/browser/application_context.h" | 13 #include "ios/chrome/browser/application_context.h" |
15 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" | 14 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
16 #include "ios/chrome/browser/chrome_paths.h" | 15 #include "ios/chrome/browser/chrome_paths.h" |
17 #include "ios/chrome/browser/search_engines/template_url_service_factory.h" | 16 #include "ios/chrome/browser/search_engines/template_url_service_factory.h" |
18 #include "ios/web/public/web_thread.h" | 17 #include "ios/web/public/web_thread.h" |
19 | 18 |
20 std::unique_ptr<ntp_tiles::PopularSites> | 19 std::unique_ptr<ntp_tiles::PopularSites> |
21 IOSPopularSitesFactory::NewForBrowserState( | 20 IOSPopularSitesFactory::NewForBrowserState( |
22 ios::ChromeBrowserState* browser_state) { | 21 ios::ChromeBrowserState* browser_state) { |
23 base::FilePath popular_sites_path; | 22 base::FilePath popular_sites_path; |
24 base::PathService::Get(ios::DIR_USER_DATA, &popular_sites_path); | 23 base::PathService::Get(ios::DIR_USER_DATA, &popular_sites_path); |
25 return base::MakeUnique<ntp_tiles::PopularSitesImpl>( | 24 return base::MakeUnique<ntp_tiles::PopularSitesImpl>( |
26 web::WebThread::GetBlockingPool(), browser_state->GetPrefs(), | 25 web::WebThread::GetBlockingPool(), browser_state->GetPrefs(), |
27 ios::TemplateURLServiceFactory::GetForBrowserState(browser_state), | 26 ios::TemplateURLServiceFactory::GetForBrowserState(browser_state), |
28 GetApplicationContext()->GetVariationsService(), | 27 GetApplicationContext()->GetVariationsService(), |
29 browser_state->GetRequestContext(), popular_sites_path, | 28 browser_state->GetRequestContext(), popular_sites_path, |
30 base::Bind(ntp_tiles::JsonUnsafeParser::Parse)); | 29 base::Bind(ntp_tiles::JsonUnsafeParser::Parse)); |
31 } | 30 } |
OLD | NEW |