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_CLIENT_H_ | 5 #ifndef COMPONENTS_NTP_TILES_WEBUI_NTP_TILES_INTERNALS_MESSAGE_HANDLER_CLIENT_H_ |
6 #define COMPONENTS_NTP_TILES_WEBUI_NTP_TILES_INTERNALS_MESSAGE_HANDLER_CLIENT_H_ | 6 #define COMPONENTS_NTP_TILES_WEBUI_NTP_TILES_INTERNALS_MESSAGE_HANDLER_CLIENT_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/callback_forward.h" | 12 #include "base/callback_forward.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "components/ntp_tiles/ntp_tile_source.h" | 14 #include "components/ntp_tiles/tile_source.h" |
15 | 15 |
16 class PrefService; | 16 class PrefService; |
17 | 17 |
18 namespace base { | 18 namespace base { |
19 class Value; | 19 class Value; |
20 class ListValue; | 20 class ListValue; |
21 } // namespace base | 21 } // namespace base |
22 | 22 |
23 namespace ntp_tiles { | 23 namespace ntp_tiles { |
24 | 24 |
25 class MostVisitedSites; | 25 class MostVisitedSites; |
26 | 26 |
27 // Implemented by embedders to hook up NTPTilesInternalsMessageHandler. | 27 // Implemented by embedders to hook up NTPTilesInternalsMessageHandler. |
28 class NTPTilesInternalsMessageHandlerClient { | 28 class NTPTilesInternalsMessageHandlerClient { |
29 public: | 29 public: |
30 // Returns the PrefService for the embedder and containing WebUI page. | 30 // Returns the PrefService for the embedder and containing WebUI page. |
31 virtual PrefService* GetPrefs() = 0; | 31 virtual PrefService* GetPrefs() = 0; |
32 | 32 |
33 // False if in a browser mode (e.g. incognito) where tiles aren't supported. | 33 // False if in a browser mode (e.g. incognito) where tiles aren't supported. |
34 virtual bool SupportsNTPTiles() = 0; | 34 virtual bool SupportsNTPTiles() = 0; |
35 | 35 |
36 // Returns true if the given source is enabled (even if, in practice, none of | 36 // Returns true if the given source is enabled (even if, in practice, none of |
37 // the tiles would come from it). | 37 // the tiles would come from it). |
38 virtual bool DoesSourceExist(NTPTileSource source) = 0; | 38 virtual bool DoesSourceExist(TileSource source) = 0; |
39 | 39 |
40 // Creates a new MostVisitedSites based on the context pf the WebUI page. | 40 // Creates a new MostVisitedSites based on the context pf the WebUI page. |
41 virtual std::unique_ptr<ntp_tiles::MostVisitedSites> | 41 virtual std::unique_ptr<ntp_tiles::MostVisitedSites> |
42 MakeMostVisitedSites() = 0; | 42 MakeMostVisitedSites() = 0; |
43 | 43 |
44 // Registers a callback in Javascript. See content::WebUI and web::WebUIIOS. | 44 // Registers a callback in Javascript. See content::WebUI and web::WebUIIOS. |
45 virtual void RegisterMessageCallback( | 45 virtual void RegisterMessageCallback( |
46 const std::string& message, | 46 const std::string& message, |
47 const base::Callback<void(const base::ListValue*)>& callback) = 0; | 47 const base::Callback<void(const base::ListValue*)>& callback) = 0; |
48 | 48 |
(...skipping 12 matching lines...) Expand all Loading... |
61 NTPTilesInternalsMessageHandlerClient(); | 61 NTPTilesInternalsMessageHandlerClient(); |
62 virtual ~NTPTilesInternalsMessageHandlerClient(); | 62 virtual ~NTPTilesInternalsMessageHandlerClient(); |
63 | 63 |
64 private: | 64 private: |
65 DISALLOW_COPY_AND_ASSIGN(NTPTilesInternalsMessageHandlerClient); | 65 DISALLOW_COPY_AND_ASSIGN(NTPTilesInternalsMessageHandlerClient); |
66 }; | 66 }; |
67 | 67 |
68 } // namespace ntp_tiles | 68 } // namespace ntp_tiles |
69 | 69 |
70 #endif // COMPONENTS_NTP_TILES_WEBUI_NTP_TILES_INTERNALS_MESSAGE_HANDLER_CLIENT
_H_ | 70 #endif // COMPONENTS_NTP_TILES_WEBUI_NTP_TILES_INTERNALS_MESSAGE_HANDLER_CLIENT
_H_ |
OLD | NEW |