Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: components/ntp_tiles/webui/site_tiles_internals_message_handler_client.h

Issue 2557103004: Add chrome://site-tiles-internals/ (Closed)
Patch Set: Fix gn check Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_NTP_TILES_WEBUI_SITE_TILES_HANDLER_CLIENT_H_
6 #define COMPONENTS_NTP_TILES_WEBUI_SITE_TILES_HANDLER_CLIENT_H_
Marc Treib 2016/12/08 15:41:50 Doesn't match the file name
sfiera 2016/12/08 16:44:35 Done.
7
8 #include <memory>
9 #include <string>
10 #include <vector>
11
12 #include "base/callback_forward.h"
13 #include "base/macros.h"
14 #include "components/ntp_tiles/ntp_tile_source.h"
15
16 class PrefService;
17
18 namespace base {
19 class Value;
20 class ListValue;
21 class SequencedWorkerPool;
22 } // namespace base
23
24 namespace ntp_tiles {
25
26 class MostVisitedSites;
27 class PopularSites;
28
29 // Implemented by embedders to hook up SiteTilesInternalsMessageHandler.
30 class SiteTilesInternalsMessageHandlerClient {
31 public:
32 // Returns the blocking pool for hte embedder.
Marc Treib 2016/12/08 15:41:50 s/hte/the/
sfiera 2016/12/08 16:44:35 Done.
33 virtual base::SequencedWorkerPool* GetBlockingPool() = 0;
34
35 // Returns the PrefService for the embedder and containing WebUI page.
36 virtual PrefService* GetPrefs() = 0;
37
38 // Returns true if the given source is enabled (even if, in practice, none of
39 // the tiles would come from it).
40 virtual bool IsSourceEnabled(NTPTileSource source) = 0;
41
42 // Creates a new MostVisited based on the context pf the WebUI page.
Marc Treib 2016/12/08 15:41:50 s/pf/of/, also below
43 virtual std::unique_ptr<ntp_tiles::MostVisitedSites>
44 MakeMostVisitedSites() = 0;
45
46 // Creates a new PopularSites based on the context pf the WebUI page.
47 virtual std::unique_ptr<ntp_tiles::PopularSites> MakePopularSites() = 0;
48
49 // Registers a callback in Javascript. See content::WebUI and web::WebUIIOS.
50 virtual void RegisterMessageCallback(
51 const std::string& message,
52 const base::Callback<void(const base::ListValue*)>& callback) = 0;
53
54 // Invokes a function in Javascript. See content::WebUI and web::WebUIIOS.
55 virtual void CallJavascriptFunctionVector(
56 const std::string& name,
57 const std::vector<const base::Value*>& values) = 0;
58
59 // Helper function for CallJavascriptFunctionVector().
60 template <typename... Arg>
61 void CallJavascriptFunction(const std::string& name, const Arg&... arg) {
62 CallJavascriptFunctionVector(name, {&arg...});
Marc Treib 2016/12/08 15:41:50 This is a bit yucky... since we only seem to have
sfiera 2016/12/08 16:44:35 (discussed elsewhere)
63 }
64
65 protected:
66 SiteTilesInternalsMessageHandlerClient();
67 virtual ~SiteTilesInternalsMessageHandlerClient();
68
69 private:
70 DISALLOW_COPY_AND_ASSIGN(SiteTilesInternalsMessageHandlerClient);
71 };
72
73 } // namespace ntp_tiles
74
75 #endif // COMPONENTS_NTP_TILES_WEBUI_SITE_TILES_HANDLER_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698