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

Side by Side Diff: 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
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 24 matching lines...) Expand all
35 public ntp_tiles::NTPTilesInternalsMessageHandlerClient { 35 public ntp_tiles::NTPTilesInternalsMessageHandlerClient {
36 public: 36 public:
37 ChromeNTPTilesInternalsMessageHandlerClient() {} 37 ChromeNTPTilesInternalsMessageHandlerClient() {}
38 38
39 private: 39 private:
40 // content::WebUIMessageHandler: 40 // content::WebUIMessageHandler:
41 void RegisterMessages() override; 41 void RegisterMessages() override;
42 42
43 // ntp_tiles::NTPTilesInternalsMessageHandlerClient 43 // ntp_tiles::NTPTilesInternalsMessageHandlerClient
44 bool SupportsNTPTiles() override; 44 bool SupportsNTPTiles() override;
45 bool DoesSourceExist(ntp_tiles::NTPTileSource source) override; 45 bool DoesSourceExist(ntp_tiles::TileSource source) override;
46 std::unique_ptr<ntp_tiles::MostVisitedSites> MakeMostVisitedSites() override; 46 std::unique_ptr<ntp_tiles::MostVisitedSites> MakeMostVisitedSites() override;
47 PrefService* GetPrefs() override; 47 PrefService* GetPrefs() override;
48 void RegisterMessageCallback( 48 void RegisterMessageCallback(
49 const std::string& message, 49 const std::string& message,
50 const base::Callback<void(const base::ListValue*)>& callback) override; 50 const base::Callback<void(const base::ListValue*)>& callback) override;
51 void CallJavascriptFunctionVector( 51 void CallJavascriptFunctionVector(
52 const std::string& name, 52 const std::string& name,
53 const std::vector<const base::Value*>& values) override; 53 const std::vector<const base::Value*>& values) override;
54 54
55 ntp_tiles::NTPTilesInternalsMessageHandler handler_; 55 ntp_tiles::NTPTilesInternalsMessageHandler handler_;
56 56
57 DISALLOW_COPY_AND_ASSIGN(ChromeNTPTilesInternalsMessageHandlerClient); 57 DISALLOW_COPY_AND_ASSIGN(ChromeNTPTilesInternalsMessageHandlerClient);
58 }; 58 };
59 59
60 void ChromeNTPTilesInternalsMessageHandlerClient::RegisterMessages() { 60 void ChromeNTPTilesInternalsMessageHandlerClient::RegisterMessages() {
61 handler_.RegisterMessages(this); 61 handler_.RegisterMessages(this);
62 } 62 }
63 63
64 bool ChromeNTPTilesInternalsMessageHandlerClient::SupportsNTPTiles() { 64 bool ChromeNTPTilesInternalsMessageHandlerClient::SupportsNTPTiles() {
65 Profile* profile = Profile::FromWebUI(web_ui()); 65 Profile* profile = Profile::FromWebUI(web_ui());
66 return !(profile->IsGuestSession() || profile->IsOffTheRecord()); 66 return !(profile->IsGuestSession() || profile->IsOffTheRecord());
67 } 67 }
68 68
69 bool ChromeNTPTilesInternalsMessageHandlerClient::DoesSourceExist( 69 bool ChromeNTPTilesInternalsMessageHandlerClient::DoesSourceExist(
70 ntp_tiles::NTPTileSource source) { 70 ntp_tiles::TileSource source) {
71 switch (source) { 71 switch (source) {
72 case ntp_tiles::NTPTileSource::TOP_SITES: 72 case ntp_tiles::TileSource::TOP_SITES:
73 case ntp_tiles::NTPTileSource::SUGGESTIONS_SERVICE: 73 case ntp_tiles::TileSource::SUGGESTIONS_SERVICE:
74 case ntp_tiles::NTPTileSource::WHITELIST: 74 case ntp_tiles::TileSource::WHITELIST:
75 return true; 75 return true;
76 case ntp_tiles::NTPTileSource::POPULAR: 76 case ntp_tiles::TileSource::POPULAR:
77 #if defined(OS_ANDROID) 77 #if defined(OS_ANDROID)
78 return true; 78 return true;
79 #else 79 #else
80 return false; 80 return false;
81 #endif 81 #endif
82 } 82 }
83 NOTREACHED(); 83 NOTREACHED();
84 return false; 84 return false;
85 } 85 }
86 86
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 121
122 NTPTilesInternalsUI::NTPTilesInternalsUI(content::WebUI* web_ui) 122 NTPTilesInternalsUI::NTPTilesInternalsUI(content::WebUI* web_ui)
123 : WebUIController(web_ui) { 123 : WebUIController(web_ui) {
124 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), 124 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui),
125 CreateNTPTilesInternalsHTMLSource()); 125 CreateNTPTilesInternalsHTMLSource());
126 web_ui->AddMessageHandler( 126 web_ui->AddMessageHandler(
127 base::MakeUnique<ChromeNTPTilesInternalsMessageHandlerClient>()); 127 base::MakeUnique<ChromeNTPTilesInternalsMessageHandlerClient>());
128 } 128 }
129 129
130 NTPTilesInternalsUI::~NTPTilesInternalsUI() {} 130 NTPTilesInternalsUI::~NTPTilesInternalsUI() {}
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/ntp/ntp_user_data_logger_unittest.cc ('k') | chrome/common/instant.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698