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

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

Issue 2572133002: Add more features to ntp-tiles-internal (Closed)
Patch Set: Add ntp_tiles owners to client webui owners Created 3 years, 10 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/popular_sites_internals_ui.h" 5 #include "chrome/browser/ui/webui/popular_sites_internals_ui.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "chrome/browser/ntp_tiles/chrome_popular_sites_factory.h" 8 #include "chrome/browser/ntp_tiles/chrome_popular_sites_factory.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/common/url_constants.h" 10 #include "chrome/common/url_constants.h"
(...skipping 13 matching lines...) Expand all
24 : public content::WebUIMessageHandler, 24 : public content::WebUIMessageHandler,
25 public ntp_tiles::PopularSitesInternalsMessageHandlerClient { 25 public ntp_tiles::PopularSitesInternalsMessageHandlerClient {
26 public: 26 public:
27 ChromePopularSitesInternalsMessageHandlerBridge() : handler_(this) {} 27 ChromePopularSitesInternalsMessageHandlerBridge() : handler_(this) {}
28 28
29 private: 29 private:
30 // content::WebUIMessageHandler: 30 // content::WebUIMessageHandler:
31 void RegisterMessages() override; 31 void RegisterMessages() override;
32 32
33 // ntp_tiles::PopularSitesInternalsMessageHandlerClient 33 // ntp_tiles::PopularSitesInternalsMessageHandlerClient
34 base::SequencedWorkerPool* GetBlockingPool() override;
35 std::unique_ptr<ntp_tiles::PopularSites> MakePopularSites() override; 34 std::unique_ptr<ntp_tiles::PopularSites> MakePopularSites() override;
36 PrefService* GetPrefs() override; 35 PrefService* GetPrefs() override;
37 void RegisterMessageCallback( 36 void RegisterMessageCallback(
38 const std::string& message, 37 const std::string& message,
39 const base::Callback<void(const base::ListValue*)>& callback) override; 38 const base::Callback<void(const base::ListValue*)>& callback) override;
40 void CallJavascriptFunctionVector( 39 void CallJavascriptFunctionVector(
41 const std::string& name, 40 const std::string& name,
42 const std::vector<const base::Value*>& values) override; 41 const std::vector<const base::Value*>& values) override;
43 42
44 ntp_tiles::PopularSitesInternalsMessageHandler handler_; 43 ntp_tiles::PopularSitesInternalsMessageHandler handler_;
45 44
46 DISALLOW_COPY_AND_ASSIGN(ChromePopularSitesInternalsMessageHandlerBridge); 45 DISALLOW_COPY_AND_ASSIGN(ChromePopularSitesInternalsMessageHandlerBridge);
47 }; 46 };
48 47
49 void ChromePopularSitesInternalsMessageHandlerBridge::RegisterMessages() { 48 void ChromePopularSitesInternalsMessageHandlerBridge::RegisterMessages() {
50 handler_.RegisterMessages(); 49 handler_.RegisterMessages();
51 } 50 }
52 51
53 base::SequencedWorkerPool*
54 ChromePopularSitesInternalsMessageHandlerBridge::GetBlockingPool() {
55 return content::BrowserThread::GetBlockingPool();
56 }
57
58 std::unique_ptr<ntp_tiles::PopularSites> 52 std::unique_ptr<ntp_tiles::PopularSites>
59 ChromePopularSitesInternalsMessageHandlerBridge::MakePopularSites() { 53 ChromePopularSitesInternalsMessageHandlerBridge::MakePopularSites() {
60 return ChromePopularSitesFactory::NewForProfile(Profile::FromWebUI(web_ui())); 54 return ChromePopularSitesFactory::NewForProfile(Profile::FromWebUI(web_ui()));
61 } 55 }
62 56
63 PrefService* ChromePopularSitesInternalsMessageHandlerBridge::GetPrefs() { 57 PrefService* ChromePopularSitesInternalsMessageHandlerBridge::GetPrefs() {
64 return Profile::FromWebUI(web_ui())->GetPrefs(); 58 return Profile::FromWebUI(web_ui())->GetPrefs();
65 } 59 }
66 60
67 void ChromePopularSitesInternalsMessageHandlerBridge::RegisterMessageCallback( 61 void ChromePopularSitesInternalsMessageHandlerBridge::RegisterMessageCallback(
(...skipping 25 matching lines...) Expand all
93 87
94 PopularSitesInternalsUI::PopularSitesInternalsUI(content::WebUI* web_ui) 88 PopularSitesInternalsUI::PopularSitesInternalsUI(content::WebUI* web_ui)
95 : WebUIController(web_ui) { 89 : WebUIController(web_ui) {
96 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), 90 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui),
97 CreatePopularSitesInternalsHTMLSource()); 91 CreatePopularSitesInternalsHTMLSource());
98 web_ui->AddMessageHandler( 92 web_ui->AddMessageHandler(
99 base::MakeUnique<ChromePopularSitesInternalsMessageHandlerBridge>()); 93 base::MakeUnique<ChromePopularSitesInternalsMessageHandlerBridge>());
100 } 94 }
101 95
102 PopularSitesInternalsUI::~PopularSitesInternalsUI() {} 96 PopularSitesInternalsUI::~PopularSitesInternalsUI() {}
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/ntp_tiles_internals_ui.cc ('k') | components/ntp_tiles/most_visited_sites.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698