| Index: chrome/browser/ui/webui/popular_sites_internals_message_handler.cc
|
| diff --git a/chrome/browser/ui/webui/popular_sites_internals_message_handler.cc b/chrome/browser/ui/webui/popular_sites_internals_message_handler.cc
|
| index 41ef4e77d67b573f9bb06bffc262e9da73383898..134118082cecceecd525ae7f8e410d7b5d70780f 100644
|
| --- a/chrome/browser/ui/webui/popular_sites_internals_message_handler.cc
|
| +++ b/chrome/browser/ui/webui/popular_sites_internals_message_handler.cc
|
| @@ -10,12 +10,14 @@
|
| #include "base/files/file_path.h"
|
| #include "base/files/file_util.h"
|
| #include "base/memory/ref_counted.h"
|
| +#include "base/path_service.h"
|
| #include "base/task_runner_util.h"
|
| #include "base/values.h"
|
| #include "chrome/browser/android/ntp/popular_sites.h"
|
| #include "chrome/browser/browser_process.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| #include "chrome/browser/search_engines/template_url_service_factory.h"
|
| +#include "chrome/common/chrome_paths.h"
|
| #include "components/ntp_tiles/pref_names.h"
|
| #include "components/prefs/pref_service.h"
|
| #include "components/url_formatter/url_fixer.h"
|
| @@ -31,6 +33,12 @@ std::string ReadFileToString(const base::FilePath& path) {
|
| return result;
|
| }
|
|
|
| +base::FilePath GetPopularSitesDirectory() {
|
| + base::FilePath dir;
|
| + PathService::Get(chrome::DIR_USER_DATA, &dir);
|
| + return dir; // empty if PathService::Get() failed.
|
| +}
|
| +
|
| } // namespace
|
|
|
| PopularSitesInternalsMessageHandler::PopularSitesInternalsMessageHandler()
|
| @@ -61,11 +69,9 @@ void PopularSitesInternalsMessageHandler::HandleRegisterForEvents(
|
|
|
| Profile* profile = Profile::FromWebUI(web_ui());
|
| popular_sites_.reset(new PopularSites(
|
| - profile->GetPrefs(),
|
| - TemplateURLServiceFactory::GetForProfile(profile),
|
| - g_browser_process->variations_service(),
|
| - profile->GetRequestContext(),
|
| - std::string(), std::string(), false,
|
| + profile->GetPrefs(), TemplateURLServiceFactory::GetForProfile(profile),
|
| + g_browser_process->variations_service(), profile->GetRequestContext(),
|
| + GetPopularSitesDirectory(), std::string(), std::string(), false,
|
| base::Bind(&PopularSitesInternalsMessageHandler::OnPopularSitesAvailable,
|
| base::Unretained(this), false)));
|
| }
|
| @@ -98,19 +104,17 @@ void PopularSitesInternalsMessageHandler::HandleUpdate(
|
| args->GetString(0, &url);
|
| if (!url.empty()) {
|
| popular_sites_.reset(new PopularSites(
|
| - profile->GetPrefs(),
|
| - TemplateURLServiceFactory::GetForProfile(profile),
|
| - profile->GetRequestContext(),
|
| + profile->GetPrefs(), TemplateURLServiceFactory::GetForProfile(profile),
|
| + profile->GetRequestContext(), GetPopularSitesDirectory(),
|
| url_formatter::FixupURL(url, std::string()), callback));
|
| return;
|
| }
|
|
|
| popular_sites_.reset(new PopularSites(
|
| - profile->GetPrefs(),
|
| - TemplateURLServiceFactory::GetForProfile(profile),
|
| - g_browser_process->variations_service(),
|
| - profile->GetRequestContext(),
|
| - std::string(), std::string(), true, callback));
|
| + profile->GetPrefs(), TemplateURLServiceFactory::GetForProfile(profile),
|
| + g_browser_process->variations_service(), profile->GetRequestContext(),
|
| + GetPopularSitesDirectory(), std::string(), std::string(), true,
|
| + callback));
|
| }
|
|
|
| void PopularSitesInternalsMessageHandler::HandleViewJson(
|
|
|