| 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/ui/webui/popular_sites_internals_message_handler.h" | 5 #include "chrome/browser/ui/webui/popular_sites_internals_message_handler.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/task_runner_util.h" | 13 #include "base/task_runner_util.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "chrome/browser/android/ntp/popular_sites.h" | 15 #include "chrome/browser/android/ntp/popular_sites.h" |
| 16 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/search_engines/template_url_service_factory.h" | 18 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 19 #include "components/ntp_tiles/pref_names.h" | 19 #include "components/ntp_tiles/pref_names.h" |
| 20 #include "components/prefs/pref_service.h" | 20 #include "components/prefs/pref_service.h" |
| 21 #include "components/url_formatter/url_fixer.h" | 21 #include "components/url_formatter/url_fixer.h" |
| 22 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
| 23 #include "content/public/browser/web_ui.h" | 23 #include "content/public/browser/web_ui.h" |
| 24 | 24 |
| 25 using ntp_tiles::PopularSites; |
| 26 |
| 25 namespace { | 27 namespace { |
| 26 | 28 |
| 27 std::string ReadFileToString(const base::FilePath& path) { | 29 std::string ReadFileToString(const base::FilePath& path) { |
| 28 std::string result; | 30 std::string result; |
| 29 if (!base::ReadFileToString(path, &result)) | 31 if (!base::ReadFileToString(path, &result)) |
| 30 result.clear(); | 32 result.clear(); |
| 31 return result; | 33 return result; |
| 32 } | 34 } |
| 33 | 35 |
| 34 } // namespace | 36 } // namespace |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 web_ui()->CallJavascriptFunctionUnsafe( | 166 web_ui()->CallJavascriptFunctionUnsafe( |
| 165 "chrome.popular_sites_internals.receiveJson", base::StringValue(json)); | 167 "chrome.popular_sites_internals.receiveJson", base::StringValue(json)); |
| 166 } | 168 } |
| 167 | 169 |
| 168 void PopularSitesInternalsMessageHandler::OnPopularSitesAvailable( | 170 void PopularSitesInternalsMessageHandler::OnPopularSitesAvailable( |
| 169 bool explicit_request, bool success) { | 171 bool explicit_request, bool success) { |
| 170 if (explicit_request) | 172 if (explicit_request) |
| 171 SendDownloadResult(success); | 173 SendDownloadResult(success); |
| 172 SendSites(); | 174 SendSites(); |
| 173 } | 175 } |
| OLD | NEW |