| OLD | NEW |
| 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 "chrome/browser/android/ntp/popular_sites.h" | 5 #include "chrome/browser/android/ntp/popular_sites.h" |
| 6 | 6 |
| 7 #include "base/bind.h" |
| 8 #include "base/memory/ptr_util.h" |
| 7 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "chrome/browser/browser_process.h" |
| 11 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 8 #include "chrome/common/chrome_paths.h" | 13 #include "chrome/common/chrome_paths.h" |
| 14 #include "components/ntp_tiles/popular_sites.h" |
| 15 #include "components/safe_json/safe_json_parser.h" |
| 16 #include "content/public/browser/browser_thread.h" |
| 9 | 17 |
| 10 base::FilePath ChromePopularSites::GetDirectory() { | 18 std::unique_ptr<ntp_tiles::PopularSites> ChromePopularSites::NewForProfile( |
| 11 base::FilePath dir; | 19 Profile* profile) { |
| 12 PathService::Get(chrome::DIR_USER_DATA, &dir); | 20 base::FilePath directory; // remains empty if PathService::Get() fails. |
| 13 return dir; // empty if PathService::Get() failed. | 21 PathService::Get(chrome::DIR_USER_DATA, &directory); |
| 22 return base::MakeUnique<ntp_tiles::PopularSites>( |
| 23 content::BrowserThread::GetBlockingPool(), profile->GetPrefs(), |
| 24 TemplateURLServiceFactory::GetForProfile(profile), |
| 25 g_browser_process->variations_service(), profile->GetRequestContext(), |
| 26 directory, base::Bind(safe_json::SafeJsonParser::Parse)); |
| 14 } | 27 } |
| OLD | NEW |