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