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

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

Issue 2790463003: ntp_tiles: Cleanup enum names (Closed)
Patch Set: add back histogram enums Created 3 years, 8 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/ntp/most_visited_cell.mm ('k') | tools/metrics/histograms/histograms.xml » ('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 "ios/chrome/browser/ui/webui/ntp_tiles_internals_ui.h" 5 #include "ios/chrome/browser/ui/webui/ntp_tiles_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/field_trial.h" 9 #include "components/ntp_tiles/field_trial.h"
10 #include "components/ntp_tiles/most_visited_sites.h" 10 #include "components/ntp_tiles/most_visited_sites.h"
(...skipping 16 matching lines...) Expand all
27 public ntp_tiles::NTPTilesInternalsMessageHandlerClient { 27 public ntp_tiles::NTPTilesInternalsMessageHandlerClient {
28 public: 28 public:
29 IOSNTPTilesInternalsMessageHandlerBridge() {} 29 IOSNTPTilesInternalsMessageHandlerBridge() {}
30 30
31 private: 31 private:
32 // web::WebUIIOSMessageHandler: 32 // web::WebUIIOSMessageHandler:
33 void RegisterMessages() override; 33 void RegisterMessages() override;
34 34
35 // ntp_tiles::NTPTilesInternalsMessageHandlerClient 35 // ntp_tiles::NTPTilesInternalsMessageHandlerClient
36 bool SupportsNTPTiles() override; 36 bool SupportsNTPTiles() override;
37 bool DoesSourceExist(ntp_tiles::NTPTileSource source) override; 37 bool DoesSourceExist(ntp_tiles::TileSource source) override;
38 std::unique_ptr<ntp_tiles::MostVisitedSites> MakeMostVisitedSites() override; 38 std::unique_ptr<ntp_tiles::MostVisitedSites> MakeMostVisitedSites() override;
39 PrefService* GetPrefs() override; 39 PrefService* GetPrefs() override;
40 void RegisterMessageCallback( 40 void RegisterMessageCallback(
41 const std::string& message, 41 const std::string& message,
42 const base::Callback<void(const base::ListValue*)>& callback) override; 42 const base::Callback<void(const base::ListValue*)>& callback) override;
43 void CallJavascriptFunctionVector( 43 void CallJavascriptFunctionVector(
44 const std::string& name, 44 const std::string& name,
45 const std::vector<const base::Value*>& values) override; 45 const std::vector<const base::Value*>& values) override;
46 46
47 ntp_tiles::NTPTilesInternalsMessageHandler handler_; 47 ntp_tiles::NTPTilesInternalsMessageHandler handler_;
48 48
49 DISALLOW_COPY_AND_ASSIGN(IOSNTPTilesInternalsMessageHandlerBridge); 49 DISALLOW_COPY_AND_ASSIGN(IOSNTPTilesInternalsMessageHandlerBridge);
50 }; 50 };
51 51
52 void IOSNTPTilesInternalsMessageHandlerBridge::RegisterMessages() { 52 void IOSNTPTilesInternalsMessageHandlerBridge::RegisterMessages() {
53 handler_.RegisterMessages(this); 53 handler_.RegisterMessages(this);
54 } 54 }
55 55
56 bool IOSNTPTilesInternalsMessageHandlerBridge::SupportsNTPTiles() { 56 bool IOSNTPTilesInternalsMessageHandlerBridge::SupportsNTPTiles() {
57 return !ios::ChromeBrowserState::FromWebUIIOS(web_ui())->IsOffTheRecord(); 57 return !ios::ChromeBrowserState::FromWebUIIOS(web_ui())->IsOffTheRecord();
58 } 58 }
59 59
60 bool IOSNTPTilesInternalsMessageHandlerBridge::DoesSourceExist( 60 bool IOSNTPTilesInternalsMessageHandlerBridge::DoesSourceExist(
61 ntp_tiles::NTPTileSource source) { 61 ntp_tiles::TileSource source) {
62 switch (source) { 62 switch (source) {
63 case ntp_tiles::NTPTileSource::TOP_SITES: 63 case ntp_tiles::TileSource::TOP_SITES:
64 case ntp_tiles::NTPTileSource::SUGGESTIONS_SERVICE: 64 case ntp_tiles::TileSource::SUGGESTIONS_SERVICE:
65 case ntp_tiles::NTPTileSource::POPULAR: 65 case ntp_tiles::TileSource::POPULAR:
66 return true; 66 return true;
67 case ntp_tiles::NTPTileSource::WHITELIST: 67 case ntp_tiles::TileSource::WHITELIST:
68 return false; 68 return false;
69 } 69 }
70 NOTREACHED(); 70 NOTREACHED();
71 return false; 71 return false;
72 } 72 }
73 73
74 std::unique_ptr<ntp_tiles::MostVisitedSites> 74 std::unique_ptr<ntp_tiles::MostVisitedSites>
75 IOSNTPTilesInternalsMessageHandlerBridge::MakeMostVisitedSites() { 75 IOSNTPTilesInternalsMessageHandlerBridge::MakeMostVisitedSites() {
76 return IOSMostVisitedSitesFactory::NewForBrowserState( 76 return IOSMostVisitedSitesFactory::NewForBrowserState(
77 ios::ChromeBrowserState::FromWebUIIOS(web_ui())); 77 ios::ChromeBrowserState::FromWebUIIOS(web_ui()));
(...skipping 30 matching lines...) Expand all
108 108
109 NTPTilesInternalsUI::NTPTilesInternalsUI(web::WebUIIOS* web_ui) 109 NTPTilesInternalsUI::NTPTilesInternalsUI(web::WebUIIOS* web_ui)
110 : web::WebUIIOSController(web_ui) { 110 : web::WebUIIOSController(web_ui) {
111 web::WebUIIOSDataSource::Add(ios::ChromeBrowserState::FromWebUIIOS(web_ui), 111 web::WebUIIOSDataSource::Add(ios::ChromeBrowserState::FromWebUIIOS(web_ui),
112 CreateNTPTilesInternalsHTMLSource()); 112 CreateNTPTilesInternalsHTMLSource());
113 web_ui->AddMessageHandler( 113 web_ui->AddMessageHandler(
114 base::MakeUnique<IOSNTPTilesInternalsMessageHandlerBridge>()); 114 base::MakeUnique<IOSNTPTilesInternalsMessageHandlerBridge>());
115 } 115 }
116 116
117 NTPTilesInternalsUI::~NTPTilesInternalsUI() {} 117 NTPTilesInternalsUI::~NTPTilesInternalsUI() {}
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/ntp/most_visited_cell.mm ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698