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

Side by Side Diff: chrome/browser/ui/webui/ntp_tiles_internals_ui.cc

Issue 2936793002: ntp_tiles: Extend chrome://ntp-tiles-internals with favicon data (Closed)
Patch Set: Avoid using std::pair with constexpr. Created 3 years, 6 months 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
« no previous file with comments | « no previous file | components/ntp_tiles/webui/ntp_tiles_internals_message_handler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "chrome/browser/ui/webui/ntp_tiles_internals_ui.h" 5 #include "chrome/browser/ui/webui/ntp_tiles_internals_ui.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "chrome/browser/favicon/favicon_service_factory.h" 9 #include "chrome/browser/favicon/favicon_service_factory.h"
10 #include "chrome/browser/history/top_sites_factory.h" 10 #include "chrome/browser/history/top_sites_factory.h"
(...skipping 16 matching lines...) Expand all
27 #include "content/public/browser/web_ui_data_source.h" 27 #include "content/public/browser/web_ui_data_source.h"
28 #include "content/public/browser/web_ui_message_handler.h" 28 #include "content/public/browser/web_ui_message_handler.h"
29 29
30 namespace { 30 namespace {
31 31
32 // The implementation for the chrome://ntp-tiles-internals page. 32 // The implementation for the chrome://ntp-tiles-internals page.
33 class ChromeNTPTilesInternalsMessageHandlerClient 33 class ChromeNTPTilesInternalsMessageHandlerClient
34 : public content::WebUIMessageHandler, 34 : public content::WebUIMessageHandler,
35 public ntp_tiles::NTPTilesInternalsMessageHandlerClient { 35 public ntp_tiles::NTPTilesInternalsMessageHandlerClient {
36 public: 36 public:
37 ChromeNTPTilesInternalsMessageHandlerClient() {} 37 // |favicon_service| must not be null and must outlive this object.
38 explicit ChromeNTPTilesInternalsMessageHandlerClient(
39 favicon::FaviconService* favicon_service)
40 : handler_(favicon_service) {}
38 41
39 private: 42 private:
40 // content::WebUIMessageHandler: 43 // content::WebUIMessageHandler:
41 void RegisterMessages() override; 44 void RegisterMessages() override;
42 45
43 // ntp_tiles::NTPTilesInternalsMessageHandlerClient 46 // ntp_tiles::NTPTilesInternalsMessageHandlerClient
44 bool SupportsNTPTiles() override; 47 bool SupportsNTPTiles() override;
45 bool DoesSourceExist(ntp_tiles::TileSource source) override; 48 bool DoesSourceExist(ntp_tiles::TileSource source) override;
46 std::unique_ptr<ntp_tiles::MostVisitedSites> MakeMostVisitedSites() override; 49 std::unique_ptr<ntp_tiles::MostVisitedSites> MakeMostVisitedSites() override;
47 PrefService* GetPrefs() override; 50 PrefService* GetPrefs() override;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 source->AddResourcePath("ntp_tiles_internals.css", 118 source->AddResourcePath("ntp_tiles_internals.css",
116 IDR_NTP_TILES_INTERNALS_CSS); 119 IDR_NTP_TILES_INTERNALS_CSS);
117 source->SetDefaultResource(IDR_NTP_TILES_INTERNALS_HTML); 120 source->SetDefaultResource(IDR_NTP_TILES_INTERNALS_HTML);
118 return source; 121 return source;
119 } 122 }
120 123
121 } // namespace 124 } // namespace
122 125
123 NTPTilesInternalsUI::NTPTilesInternalsUI(content::WebUI* web_ui) 126 NTPTilesInternalsUI::NTPTilesInternalsUI(content::WebUI* web_ui)
124 : WebUIController(web_ui) { 127 : WebUIController(web_ui) {
125 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), 128 Profile* profile = Profile::FromWebUI(web_ui);
126 CreateNTPTilesInternalsHTMLSource()); 129 content::WebUIDataSource::Add(profile, CreateNTPTilesInternalsHTMLSource());
127 web_ui->AddMessageHandler( 130 web_ui->AddMessageHandler(
128 base::MakeUnique<ChromeNTPTilesInternalsMessageHandlerClient>()); 131 base::MakeUnique<ChromeNTPTilesInternalsMessageHandlerClient>(
132 FaviconServiceFactory::GetForProfile(
133 profile, ServiceAccessType::EXPLICIT_ACCESS)));
129 } 134 }
130 135
131 NTPTilesInternalsUI::~NTPTilesInternalsUI() {} 136 NTPTilesInternalsUI::~NTPTilesInternalsUI() {}
OLDNEW
« no previous file with comments | « no previous file | components/ntp_tiles/webui/ntp_tiles_internals_message_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698