| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 157 } | 157 } | 
| 158 | 158 | 
| 159 void NTPTilesInternalsMessageHandler::HandleViewPopularSitesJson( | 159 void NTPTilesInternalsMessageHandler::HandleViewPopularSitesJson( | 
| 160     const base::ListValue* args) { | 160     const base::ListValue* args) { | 
| 161   DCHECK_EQ(0u, args->GetSize()); | 161   DCHECK_EQ(0u, args->GetSize()); | 
| 162   if (!most_visited_sites_->DoesSourceExist( | 162   if (!most_visited_sites_->DoesSourceExist( | 
| 163           ntp_tiles::NTPTileSource::POPULAR)) { | 163           ntp_tiles::NTPTileSource::POPULAR)) { | 
| 164     return; | 164     return; | 
| 165   } | 165   } | 
| 166 | 166 | 
| 167   popular_sites_json_ = FormatJson( | 167   popular_sites_json_ = | 
| 168       *most_visited_sites_->popular_sites()->GetCachedJson()); | 168       FormatJson(*most_visited_sites_->popular_sites()->GetCachedJson()); | 
| 169   SendSourceInfo(); | 169   SendSourceInfo(); | 
| 170 } | 170 } | 
| 171 | 171 | 
| 172 void NTPTilesInternalsMessageHandler::SendSourceInfo() { | 172 void NTPTilesInternalsMessageHandler::SendSourceInfo() { | 
| 173   PrefService* prefs = client_->GetPrefs(); | 173   PrefService* prefs = client_->GetPrefs(); | 
| 174   base::DictionaryValue value; | 174   base::DictionaryValue value; | 
| 175 | 175 | 
| 176   value.SetBoolean("topSites", most_visited_sites_->DoesSourceExist( | 176   value.SetBoolean("topSites", most_visited_sites_->DoesSourceExist( | 
| 177                                    NTPTileSource::TOP_SITES)); | 177                                    NTPTileSource::TOP_SITES)); | 
| 178   value.SetBoolean("whitelist", most_visited_sites_->DoesSourceExist( | 178   value.SetBoolean("whitelist", most_visited_sites_->DoesSourceExist( | 
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 230 | 230 | 
| 231 void NTPTilesInternalsMessageHandler::OnMostVisitedURLsAvailable( | 231 void NTPTilesInternalsMessageHandler::OnMostVisitedURLsAvailable( | 
| 232     const NTPTilesVector& tiles) { | 232     const NTPTilesVector& tiles) { | 
| 233   SendTiles(tiles); | 233   SendTiles(tiles); | 
| 234 } | 234 } | 
| 235 | 235 | 
| 236 void NTPTilesInternalsMessageHandler::OnIconMadeAvailable( | 236 void NTPTilesInternalsMessageHandler::OnIconMadeAvailable( | 
| 237     const GURL& site_url) {} | 237     const GURL& site_url) {} | 
| 238 | 238 | 
| 239 }  // namespace ntp_tiles | 239 }  // namespace ntp_tiles | 
| OLD | NEW | 
|---|