| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_UI_WEBUI_POPULAR_SITES_INTERNALS_MESSAGE_HANDLER_H_ | |
| 6 #define CHROME_BROWSER_UI_WEBUI_POPULAR_SITES_INTERNALS_MESSAGE_HANDLER_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/macros.h" | |
| 12 #include "base/memory/weak_ptr.h" | |
| 13 #include "content/public/browser/web_ui_message_handler.h" | |
| 14 | |
| 15 namespace base { | |
| 16 class ListValue; | |
| 17 } // namespace base | |
| 18 | |
| 19 namespace ntp_tiles { | |
| 20 class PopularSites; | |
| 21 } // namespace ntp_tiles | |
| 22 | |
| 23 // The implementation for the chrome://popular-sites-internals page. | |
| 24 class PopularSitesInternalsMessageHandler | |
| 25 : public content::WebUIMessageHandler { | |
| 26 public: | |
| 27 PopularSitesInternalsMessageHandler(); | |
| 28 ~PopularSitesInternalsMessageHandler() override; | |
| 29 | |
| 30 private: | |
| 31 // content::WebUIMessageHandler: | |
| 32 void RegisterMessages() override; | |
| 33 | |
| 34 void HandleRegisterForEvents(const base::ListValue* args); | |
| 35 void HandleUpdate(const base::ListValue* args); | |
| 36 void HandleViewJson(const base::ListValue* args); | |
| 37 | |
| 38 void SendOverrides(); | |
| 39 void SendDownloadResult(bool success); | |
| 40 void SendSites(); | |
| 41 void SendJson(const std::string& json); | |
| 42 | |
| 43 void OnPopularSitesAvailable(bool explicit_request, bool success); | |
| 44 | |
| 45 std::unique_ptr<ntp_tiles::PopularSites> popular_sites_; | |
| 46 | |
| 47 base::WeakPtrFactory<PopularSitesInternalsMessageHandler> weak_ptr_factory_; | |
| 48 | |
| 49 DISALLOW_COPY_AND_ASSIGN(PopularSitesInternalsMessageHandler); | |
| 50 }; | |
| 51 | |
| 52 #endif // CHROME_BROWSER_UI_WEBUI_POPULAR_SITES_INTERNALS_MESSAGE_HANDLER_H_ | |
| OLD | NEW |