| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 COMPONENTS_NTP_TILES_WEBUI_NTP_TILES_INTERNALS_MESSAGE_HANDLER_H_ | 5 #ifndef COMPONENTS_NTP_TILES_WEBUI_NTP_TILES_INTERNALS_MESSAGE_HANDLER_H_ |
| 6 #define COMPONENTS_NTP_TILES_WEBUI_NTP_TILES_INTERNALS_MESSAGE_HANDLER_H_ | 6 #define COMPONENTS_NTP_TILES_WEBUI_NTP_TILES_INTERNALS_MESSAGE_HANDLER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 ~NTPTilesInternalsMessageHandler() override; | 32 ~NTPTilesInternalsMessageHandler() override; |
| 33 | 33 |
| 34 // Called when the WebUI page's JavaScript has loaded and it is ready to | 34 // Called when the WebUI page's JavaScript has loaded and it is ready to |
| 35 // receive RegisterMessageCallback() calls. |client| must outlive this object. | 35 // receive RegisterMessageCallback() calls. |client| must outlive this object. |
| 36 void RegisterMessages(NTPTilesInternalsMessageHandlerClient* client); | 36 void RegisterMessages(NTPTilesInternalsMessageHandlerClient* client); |
| 37 | 37 |
| 38 private: | 38 private: |
| 39 // Callbacks registered in RegisterMessages(). | 39 // Callbacks registered in RegisterMessages(). |
| 40 void HandleRegisterForEvents(const base::ListValue* args); | 40 void HandleRegisterForEvents(const base::ListValue* args); |
| 41 void HandleUpdate(const base::ListValue* args); | 41 void HandleUpdate(const base::ListValue* args); |
| 42 void HandleFetchSuggestions(const base::ListValue* args); |
| 43 void HandleViewPopularSitesJson(const base::ListValue* args); |
| 42 | 44 |
| 43 void SendSourceInfo(); | 45 void SendSourceInfo(); |
| 44 void SendTiles(const NTPTilesVector& tiles); | 46 void SendTiles(const NTPTilesVector& tiles); |
| 47 void PopularSitesJsonRead(const std::unique_ptr<std::string>& content); |
| 45 | 48 |
| 46 // MostVisitedSites::Observer. | 49 // MostVisitedSites::Observer. |
| 47 void OnMostVisitedURLsAvailable(const NTPTilesVector& tiles) override; | 50 void OnMostVisitedURLsAvailable(const NTPTilesVector& tiles) override; |
| 48 void OnIconMadeAvailable(const GURL& site_url) override; | 51 void OnIconMadeAvailable(const GURL& site_url) override; |
| 49 | 52 |
| 50 // Bridge to embedder's API. | 53 // Bridge to embedder's API. |
| 51 NTPTilesInternalsMessageHandlerClient* client_; | 54 NTPTilesInternalsMessageHandlerClient* client_; |
| 52 | 55 |
| 53 int site_count_; | 56 int site_count_; |
| 54 std::unique_ptr<MostVisitedSites> most_visited_sites_; | 57 std::unique_ptr<MostVisitedSites> most_visited_sites_; |
| 55 | 58 |
| 59 std::string suggestions_status_; |
| 60 std::string popular_sites_json_; |
| 61 |
| 62 base::WeakPtrFactory<NTPTilesInternalsMessageHandler> weak_ptr_factory_; |
| 63 |
| 56 DISALLOW_COPY_AND_ASSIGN(NTPTilesInternalsMessageHandler); | 64 DISALLOW_COPY_AND_ASSIGN(NTPTilesInternalsMessageHandler); |
| 57 }; | 65 }; |
| 58 | 66 |
| 59 } // namespace ntp_tiles | 67 } // namespace ntp_tiles |
| 60 | 68 |
| 61 #endif // COMPONENTS_NTP_TILES_WEBUI_NTP_TILES_INTERNALS_MESSAGE_HANDLER_H_ | 69 #endif // COMPONENTS_NTP_TILES_WEBUI_NTP_TILES_INTERNALS_MESSAGE_HANDLER_H_ |
| OLD | NEW |