| 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_POPULAR_SITES_HANDLER_H_ | 5 #ifndef COMPONENTS_NTP_TILES_WEBUI_POPULAR_SITES_HANDLER_H_ |
| 6 #define COMPONENTS_NTP_TILES_WEBUI_POPULAR_SITES_HANDLER_H_ | 6 #define COMPONENTS_NTP_TILES_WEBUI_POPULAR_SITES_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 | 13 |
| 14 namespace base { | 14 namespace base { |
| 15 class ListValue; | 15 class ListValue; |
| 16 } // namespace base | 16 } // namespace base |
| 17 | 17 |
| 18 namespace ntp_tiles { | 18 namespace ntp_tiles { |
| 19 | 19 |
| 20 class PopularSites; | 20 class PopularSitesImpl; |
| 21 class PopularSitesInternalsMessageHandlerClient; | 21 class PopularSitesInternalsMessageHandlerClient; |
| 22 | 22 |
| 23 // Implements the WebUI message handler for chrome://popular-sites-internals/ | 23 // Implements the WebUI message handler for chrome://popular-sites-internals/ |
| 24 // | 24 // |
| 25 // Because content and iOS use different implementations of WebUI, this class | 25 // Because content and iOS use different implementations of WebUI, this class |
| 26 // implements the generic portion and depends on the embedder to inject a bridge | 26 // implements the generic portion and depends on the embedder to inject a bridge |
| 27 // to the embedder's API. It cannot itself implement either API directly. | 27 // to the embedder's API. It cannot itself implement either API directly. |
| 28 class PopularSitesInternalsMessageHandler { | 28 class PopularSitesInternalsMessageHandler { |
| 29 public: | 29 public: |
| 30 explicit PopularSitesInternalsMessageHandler( | 30 explicit PopularSitesInternalsMessageHandler( |
| (...skipping 14 matching lines...) Expand all Loading... |
| 45 void SendDownloadResult(bool success); | 45 void SendDownloadResult(bool success); |
| 46 void SendSites(); | 46 void SendSites(); |
| 47 void SendJson(const std::string& json); | 47 void SendJson(const std::string& json); |
| 48 | 48 |
| 49 // Completion handler for popular_sites_->StartFetch(). | 49 // Completion handler for popular_sites_->StartFetch(). |
| 50 void OnPopularSitesAvailable(bool explicit_request, bool success); | 50 void OnPopularSitesAvailable(bool explicit_request, bool success); |
| 51 | 51 |
| 52 // Bridge to embedder's API. | 52 // Bridge to embedder's API. |
| 53 PopularSitesInternalsMessageHandlerClient* web_ui_; | 53 PopularSitesInternalsMessageHandlerClient* web_ui_; |
| 54 | 54 |
| 55 std::unique_ptr<PopularSites> popular_sites_; | 55 std::unique_ptr<PopularSitesImpl> popular_sites_; |
| 56 | 56 |
| 57 base::WeakPtrFactory<PopularSitesInternalsMessageHandler> weak_ptr_factory_; | 57 base::WeakPtrFactory<PopularSitesInternalsMessageHandler> weak_ptr_factory_; |
| 58 | 58 |
| 59 DISALLOW_COPY_AND_ASSIGN(PopularSitesInternalsMessageHandler); | 59 DISALLOW_COPY_AND_ASSIGN(PopularSitesInternalsMessageHandler); |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 } // namespace ntp_tiles | 62 } // namespace ntp_tiles |
| 63 | 63 |
| 64 #endif // COMPONENTS_NTP_TILES_WEBUI_POPULAR_SITES_HANDLER_H_ | 64 #endif // COMPONENTS_NTP_TILES_WEBUI_POPULAR_SITES_HANDLER_H_ |
| OLD | NEW |