| 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 "components/ntp_tiles/json_unsafe_parser.h" | 11 #include "components/ntp_tiles/json_unsafe_parser.h" |
| 12 #include "components/ntp_tiles/popular_sites.h" | 12 #include "components/ntp_tiles/popular_sites_impl.h" |
| 13 #include "ios/chrome/browser/application_context.h" | 13 #include "ios/chrome/browser/application_context.h" |
| 14 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" | 14 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
| 15 #include "ios/chrome/browser/chrome_paths.h" | 15 #include "ios/chrome/browser/chrome_paths.h" |
| 16 #include "ios/chrome/browser/search_engines/template_url_service_factory.h" | 16 #include "ios/chrome/browser/search_engines/template_url_service_factory.h" |
| 17 #include "ios/web/public/web_thread.h" | 17 #include "ios/web/public/web_thread.h" |
| 18 | 18 |
| 19 std::unique_ptr<ntp_tiles::PopularSites> | 19 std::unique_ptr<ntp_tiles::PopularSites> |
| 20 IOSPopularSitesFactory::NewForBrowserState( | 20 IOSPopularSitesFactory::NewForBrowserState( |
| 21 ios::ChromeBrowserState* browser_state) { | 21 ios::ChromeBrowserState* browser_state) { |
| 22 base::FilePath popular_sites_path; | 22 base::FilePath popular_sites_path; |
| 23 base::PathService::Get(ios::DIR_USER_DATA, &popular_sites_path); | 23 base::PathService::Get(ios::DIR_USER_DATA, &popular_sites_path); |
| 24 return base::MakeUnique<ntp_tiles::PopularSitesImpl>( | 24 return base::MakeUnique<ntp_tiles::PopularSitesImpl>( |
| 25 web::WebThread::GetBlockingPool(), browser_state->GetPrefs(), | 25 web::WebThread::GetBlockingPool(), browser_state->GetPrefs(), |
| 26 ios::TemplateURLServiceFactory::GetForBrowserState(browser_state), | 26 ios::TemplateURLServiceFactory::GetForBrowserState(browser_state), |
| 27 GetApplicationContext()->GetVariationsService(), | 27 GetApplicationContext()->GetVariationsService(), |
| 28 browser_state->GetRequestContext(), popular_sites_path, | 28 browser_state->GetRequestContext(), popular_sites_path, |
| 29 base::Bind(ntp_tiles::JsonUnsafeParser::Parse)); | 29 base::Bind(ntp_tiles::JsonUnsafeParser::Parse)); |
| 30 } | 30 } |
| OLD | NEW |