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

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

Issue 2557103004: Add chrome://site-tiles-internals/ (Closed)
Patch Set: Address review comments 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_H_
6 #define COMPONENTS_NTP_TILES_WEBUI_SITE_TILES_HANDLER_H_
Marc Treib 2016/12/09 10:52:12 Doesn't match the file name
7
8 #include <memory>
9 #include <string>
10
11 #include "base/macros.h"
12 #include "base/memory/weak_ptr.h"
13 #include "components/ntp_tiles/most_visited_sites.h"
14
15 namespace base {
16 class ListValue;
17 } // namespace base
18
19 namespace ntp_tiles {
20
21 class MostVisitedSites;
22 class SiteTilesInternalsMessageHandlerClient;
23
24 // Implements the WebUI message handler for chrome://site-tiles-internals/
25 //
26 // Because content and iOS use different implementations of WebUI, this class
27 // implements the generic portion and depends on the embedder to inject a bridge
28 // to the embedder's API. It cannot itself implement either API directly.
29 class SiteTilesInternalsMessageHandler : public MostVisitedSites::Observer {
30 public:
31 explicit SiteTilesInternalsMessageHandler();
32 ~SiteTilesInternalsMessageHandler() override;
33
34 // Called when the WebUI page's JavaScript has loaded and it is ready to
35 // receive RegisterMessageCallback() calls.
36 void RegisterMessages(
37 SiteTilesInternalsMessageHandlerClient* client);
38
39 private:
40 // Callbacks registered in RegisterMessages().
41 void HandleRegisterForEvents(const base::ListValue* args);
42 void HandleUpdate(const base::ListValue* args);
43 void HandleGetFavicon(const base::ListValue* args);
44
45 void SendSourceInfo();
46 void SendTiles(const NTPTilesVector& tiles);
47
48 // MostVisitedSites::Observer.
49 void OnMostVisitedURLsAvailable(const NTPTilesVector& tiles) override;
50 void OnIconMadeAvailable(const GURL& site_url) override;
51
52 // Bridge to embedder's API.
53 SiteTilesInternalsMessageHandlerClient* client_;
54
55 int site_count_;
56 std::unique_ptr<MostVisitedSites> most_visited_sites_;
57
58 base::WeakPtrFactory<SiteTilesInternalsMessageHandler> weak_ptr_factory_;
Marc Treib 2016/12/09 10:52:12 Unused I think
sfiera 2016/12/09 17:35:28 Ah, yes, it was just for the removed JSON reading
59
60 DISALLOW_COPY_AND_ASSIGN(SiteTilesInternalsMessageHandler);
61 };
62
63 } // namespace ntp_tiles
64
65 #endif // COMPONENTS_NTP_TILES_WEBUI_SITE_TILES_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698