OLD | NEW |
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 "components/ntp_tiles/webui/ntp_tiles_internals_message_handler.h" | 5 #include "components/ntp_tiles/webui/ntp_tiles_internals_message_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 } | 152 } |
153 | 153 |
154 void NTPTilesInternalsMessageHandler::HandleViewPopularSitesJson( | 154 void NTPTilesInternalsMessageHandler::HandleViewPopularSitesJson( |
155 const base::ListValue* args) { | 155 const base::ListValue* args) { |
156 DCHECK_EQ(0u, args->GetSize()); | 156 DCHECK_EQ(0u, args->GetSize()); |
157 if (!most_visited_sites_->DoesSourceExist( | 157 if (!most_visited_sites_->DoesSourceExist( |
158 ntp_tiles::NTPTileSource::POPULAR)) { | 158 ntp_tiles::NTPTileSource::POPULAR)) { |
159 return; | 159 return; |
160 } | 160 } |
161 | 161 |
162 popular_sites_json_ = FormatJson( | 162 popular_sites_json_ = |
163 *most_visited_sites_->popular_sites()->GetCachedJson()); | 163 FormatJson(*most_visited_sites_->popular_sites()->GetCachedJson()); |
164 SendSourceInfo(); | 164 SendSourceInfo(); |
165 } | 165 } |
166 | 166 |
167 void NTPTilesInternalsMessageHandler::SendSourceInfo() { | 167 void NTPTilesInternalsMessageHandler::SendSourceInfo() { |
168 PrefService* prefs = client_->GetPrefs(); | 168 PrefService* prefs = client_->GetPrefs(); |
169 base::DictionaryValue value; | 169 base::DictionaryValue value; |
170 | 170 |
171 value.SetBoolean("topSites", most_visited_sites_->DoesSourceExist( | 171 value.SetBoolean("topSites", most_visited_sites_->DoesSourceExist( |
172 NTPTileSource::TOP_SITES)); | 172 NTPTileSource::TOP_SITES)); |
173 value.SetBoolean("whitelist", most_visited_sites_->DoesSourceExist( | 173 value.SetBoolean("whitelist", most_visited_sites_->DoesSourceExist( |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 | 225 |
226 void NTPTilesInternalsMessageHandler::OnMostVisitedURLsAvailable( | 226 void NTPTilesInternalsMessageHandler::OnMostVisitedURLsAvailable( |
227 const NTPTilesVector& tiles) { | 227 const NTPTilesVector& tiles) { |
228 SendTiles(tiles); | 228 SendTiles(tiles); |
229 } | 229 } |
230 | 230 |
231 void NTPTilesInternalsMessageHandler::OnIconMadeAvailable( | 231 void NTPTilesInternalsMessageHandler::OnIconMadeAvailable( |
232 const GURL& site_url) {} | 232 const GURL& site_url) {} |
233 | 233 |
234 } // namespace ntp_tiles | 234 } // namespace ntp_tiles |
OLD | NEW |