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

Side by Side Diff: ios/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
« no previous file with comments | « ios/chrome/browser/ui/webui/ntp_tiles_internals_ui.cc ('k') | no next file » | 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 "ios/chrome/browser/ui/webui/popular_sites_internals_ui.h" 5 #include "ios/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 "components/grit/components_resources.h" 8 #include "components/grit/components_resources.h"
9 #include "components/ntp_tiles/popular_sites.h" 9 #include "components/ntp_tiles/popular_sites.h"
10 #include "components/ntp_tiles/webui/popular_sites_internals_message_handler.h" 10 #include "components/ntp_tiles/webui/popular_sites_internals_message_handler.h"
(...skipping 13 matching lines...) Expand all
24 : public web::WebUIIOSMessageHandler, 24 : public web::WebUIIOSMessageHandler,
25 public ntp_tiles::PopularSitesInternalsMessageHandlerClient { 25 public ntp_tiles::PopularSitesInternalsMessageHandlerClient {
26 public: 26 public:
27 IOSPopularSitesInternalsMessageHandlerBridge() : handler_(this) {} 27 IOSPopularSitesInternalsMessageHandlerBridge() : handler_(this) {}
28 28
29 private: 29 private:
30 // web::WebUIIOSMessageHandler: 30 // web::WebUIIOSMessageHandler:
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(IOSPopularSitesInternalsMessageHandlerBridge); 45 DISALLOW_COPY_AND_ASSIGN(IOSPopularSitesInternalsMessageHandlerBridge);
47 }; 46 };
48 47
49 void IOSPopularSitesInternalsMessageHandlerBridge::RegisterMessages() { 48 void IOSPopularSitesInternalsMessageHandlerBridge::RegisterMessages() {
50 handler_.RegisterMessages(); 49 handler_.RegisterMessages();
51 } 50 }
52 51
53 base::SequencedWorkerPool*
54 IOSPopularSitesInternalsMessageHandlerBridge::GetBlockingPool() {
55 return web::WebThread::GetBlockingPool();
56 }
57
58 std::unique_ptr<ntp_tiles::PopularSites> 52 std::unique_ptr<ntp_tiles::PopularSites>
59 IOSPopularSitesInternalsMessageHandlerBridge::MakePopularSites() { 53 IOSPopularSitesInternalsMessageHandlerBridge::MakePopularSites() {
60 return IOSPopularSitesFactory::NewForBrowserState( 54 return IOSPopularSitesFactory::NewForBrowserState(
61 ios::ChromeBrowserState::FromWebUIIOS(web_ui())); 55 ios::ChromeBrowserState::FromWebUIIOS(web_ui()));
62 } 56 }
63 57
64 PrefService* IOSPopularSitesInternalsMessageHandlerBridge::GetPrefs() { 58 PrefService* IOSPopularSitesInternalsMessageHandlerBridge::GetPrefs() {
65 return ios::ChromeBrowserState::FromWebUIIOS(web_ui())->GetPrefs(); 59 return ios::ChromeBrowserState::FromWebUIIOS(web_ui())->GetPrefs();
66 } 60 }
67 61
(...skipping 25 matching lines...) Expand all
93 87
94 PopularSitesInternalsUI::PopularSitesInternalsUI(web::WebUIIOS* web_ui) 88 PopularSitesInternalsUI::PopularSitesInternalsUI(web::WebUIIOS* web_ui)
95 : web::WebUIIOSController(web_ui) { 89 : web::WebUIIOSController(web_ui) {
96 web::WebUIIOSDataSource::Add(ios::ChromeBrowserState::FromWebUIIOS(web_ui), 90 web::WebUIIOSDataSource::Add(ios::ChromeBrowserState::FromWebUIIOS(web_ui),
97 CreatePopularSitesInternalsHTMLSource()); 91 CreatePopularSitesInternalsHTMLSource());
98 web_ui->AddMessageHandler( 92 web_ui->AddMessageHandler(
99 base::MakeUnique<IOSPopularSitesInternalsMessageHandlerBridge>()); 93 base::MakeUnique<IOSPopularSitesInternalsMessageHandlerBridge>());
100 } 94 }
101 95
102 PopularSitesInternalsUI::~PopularSitesInternalsUI() {} 96 PopularSitesInternalsUI::~PopularSitesInternalsUI() {}
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/webui/ntp_tiles_internals_ui.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698