| 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 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 DCHECK_EQ(top_sites_.get(), top_sites); | 495 DCHECK_EQ(top_sites_.get(), top_sites); |
| 496 // As forced urls already come from tiles, we can safely ignore those updates. | 496 // As forced urls already come from tiles, we can safely ignore those updates. |
| 497 if (change_reason == history::TopSitesObserver::ChangeReason::FORCED_URL) | 497 if (change_reason == history::TopSitesObserver::ChangeReason::FORCED_URL) |
| 498 return; | 498 return; |
| 499 top_sites_->GetMostVisitedURLs(base::Bind(&InstantService::OnTopSitesReceived, | 499 top_sites_->GetMostVisitedURLs(base::Bind(&InstantService::OnTopSitesReceived, |
| 500 weak_ptr_factory_.GetWeakPtr()), | 500 weak_ptr_factory_.GetWeakPtr()), |
| 501 false); | 501 false); |
| 502 } | 502 } |
| 503 | 503 |
| 504 void InstantService::ResetInstantSearchPrerendererIfNecessary() { | 504 void InstantService::ResetInstantSearchPrerendererIfNecessary() { |
| 505 if (!search::ShouldPrefetchSearchResults()) | 505 if (!search::IsInstantExtendedAPIEnabled()) |
| 506 return; | 506 return; |
| 507 | 507 |
| 508 GURL url(search::GetSearchResultPrefetchBaseURL(profile_)); | 508 GURL url(search::GetSearchResultPrefetchBaseURL(profile_)); |
| 509 if (!instant_prerenderer_ || instant_prerenderer_->prerender_url() != url) { | 509 if (!instant_prerenderer_ || instant_prerenderer_->prerender_url() != url) { |
| 510 instant_prerenderer_.reset( | 510 instant_prerenderer_.reset( |
| 511 url.is_valid() ? new InstantSearchPrerenderer(profile_, url) : nullptr); | 511 url.is_valid() ? new InstantSearchPrerenderer(profile_, url) : nullptr); |
| 512 } | 512 } |
| 513 } | 513 } |
| OLD | NEW |