Chromium Code Reviews| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 96 registrar_.Add(this, | 96 registrar_.Add(this, |
| 97 content::NOTIFICATION_RENDERER_PROCESS_CREATED, | 97 content::NOTIFICATION_RENDERER_PROCESS_CREATED, |
| 98 content::NotificationService::AllSources()); | 98 content::NotificationService::AllSources()); |
| 99 registrar_.Add(this, | 99 registrar_.Add(this, |
| 100 content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, | 100 content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, |
| 101 content::NotificationService::AllSources()); | 101 content::NotificationService::AllSources()); |
| 102 | 102 |
| 103 if (base::FeatureList::IsEnabled(kNtpTilesFeature)) { | 103 if (base::FeatureList::IsEnabled(kNtpTilesFeature)) { |
| 104 most_visited_sites_ = | 104 most_visited_sites_ = |
| 105 ChromeMostVisitedSitesFactory::NewForProfile(profile_); | 105 ChromeMostVisitedSitesFactory::NewForProfile(profile_); |
| 106 most_visited_sites_->SetMostVisitedURLsObserver(this, 8); | 106 if (most_visited_sites_) |
| 107 most_visited_sites_->SetMostVisitedURLsObserver(this, 8); | |
|
sfiera
2017/02/01 11:24:57
FYI, merge conflict with https://crrev.com/2619993
Marc Treib
2017/02/01 12:42:46
Thanks for the heads-up!
Since that one doesn't lo
mastiz
2017/02/01 13:03:39
Don't worry about conflicts, I can resolve those i
| |
| 107 } else { | 108 } else { |
| 108 top_sites_ = TopSitesFactory::GetForProfile(profile_); | 109 top_sites_ = TopSitesFactory::GetForProfile(profile_); |
| 109 if (top_sites_) { | 110 if (top_sites_) { |
| 110 top_sites_->AddObserver(this); | 111 top_sites_->AddObserver(this); |
| 111 // Immediately query the TopSites state. | 112 // Immediately query the TopSites state. |
| 112 TopSitesChanged(top_sites_.get(), | 113 TopSitesChanged(top_sites_.get(), |
| 113 history::TopSitesObserver::ChangeReason::MOST_VISITED); | 114 history::TopSitesObserver::ChangeReason::MOST_VISITED); |
| 114 } | 115 } |
| 115 } | 116 } |
| 116 | 117 |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 504 void InstantService::ResetInstantSearchPrerendererIfNecessary() { | 505 void InstantService::ResetInstantSearchPrerendererIfNecessary() { |
| 505 if (!search::IsInstantExtendedAPIEnabled()) | 506 if (!search::IsInstantExtendedAPIEnabled()) |
| 506 return; | 507 return; |
| 507 | 508 |
| 508 GURL url(search::GetSearchResultPrefetchBaseURL(profile_)); | 509 GURL url(search::GetSearchResultPrefetchBaseURL(profile_)); |
| 509 if (!instant_prerenderer_ || instant_prerenderer_->prerender_url() != url) { | 510 if (!instant_prerenderer_ || instant_prerenderer_->prerender_url() != url) { |
| 510 instant_prerenderer_.reset( | 511 instant_prerenderer_.reset( |
| 511 url.is_valid() ? new InstantSearchPrerenderer(profile_, url) : nullptr); | 512 url.is_valid() ? new InstantSearchPrerenderer(profile_, url) : nullptr); |
| 512 } | 513 } |
| 513 } | 514 } |
| OLD | NEW |