| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/search/instant_service.h" | 5 #include "chrome/browser/search/instant_service.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/feature_list.h" | 10 #include "base/feature_list.h" |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 } | 286 } |
| 287 } | 287 } |
| 288 | 288 |
| 289 void InstantService::OnTopSitesReceived( | 289 void InstantService::OnTopSitesReceived( |
| 290 const history::MostVisitedURLList& data) { | 290 const history::MostVisitedURLList& data) { |
| 291 most_visited_items_.clear(); | 291 most_visited_items_.clear(); |
| 292 for (const history::MostVisitedURL& mv_url : data) { | 292 for (const history::MostVisitedURL& mv_url : data) { |
| 293 InstantMostVisitedItem item; | 293 InstantMostVisitedItem item; |
| 294 item.url = mv_url.url; | 294 item.url = mv_url.url; |
| 295 item.title = mv_url.title; | 295 item.title = mv_url.title; |
| 296 item.source = ntp_tiles::NTPTileSource::TOP_SITES; | 296 item.source = ntp_tiles::TileSource::TOP_SITES; |
| 297 most_visited_items_.push_back(item); | 297 most_visited_items_.push_back(item); |
| 298 } | 298 } |
| 299 | 299 |
| 300 NotifyAboutMostVisitedItems(); | 300 NotifyAboutMostVisitedItems(); |
| 301 } | 301 } |
| 302 | 302 |
| 303 void InstantService::OnMostVisitedURLsAvailable( | 303 void InstantService::OnMostVisitedURLsAvailable( |
| 304 const ntp_tiles::NTPTilesVector& tiles) { | 304 const ntp_tiles::NTPTilesVector& tiles) { |
| 305 DCHECK(most_visited_sites_); | 305 DCHECK(most_visited_sites_); |
| 306 most_visited_items_.clear(); | 306 most_visited_items_.clear(); |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 void InstantService::ResetInstantSearchPrerendererIfNecessary() { | 475 void InstantService::ResetInstantSearchPrerendererIfNecessary() { |
| 476 if (!search::IsInstantExtendedAPIEnabled()) | 476 if (!search::IsInstantExtendedAPIEnabled()) |
| 477 return; | 477 return; |
| 478 | 478 |
| 479 GURL url(search::GetSearchResultPrefetchBaseURL(profile_)); | 479 GURL url(search::GetSearchResultPrefetchBaseURL(profile_)); |
| 480 if (!instant_prerenderer_ || instant_prerenderer_->prerender_url() != url) { | 480 if (!instant_prerenderer_ || instant_prerenderer_->prerender_url() != url) { |
| 481 instant_prerenderer_.reset( | 481 instant_prerenderer_.reset( |
| 482 url.is_valid() ? new InstantSearchPrerenderer(profile_, url) : nullptr); | 482 url.is_valid() ? new InstantSearchPrerenderer(profile_, url) : nullptr); |
| 483 } | 483 } |
| 484 } | 484 } |
| OLD | NEW |